Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/frontend/src/ui/PadsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ const PadsDialog: React.FC<PadsDialogProps> = ({
padName: pad.display_name
});

// If deleting the active pad, switch to another pad first
// If deleting the active pad, switch to another pad first but keep dialog open
if (pad.id === activePadId && pads) {
const otherPad = pads.find(p => p.id !== pad.id);
if (otherPad && excalidrawAPI) {
handleLoadPad(otherPad);
handleLoadPad(otherPad, true); // Pass true to keep dialog open
}
}

// Call the deletePad mutation
deletePad(pad.id);
};

const handleLoadPad = (pad: PadData) => {
const handleLoadPad = (pad: PadData, keepDialogOpen: boolean = false) => {
if (!excalidrawAPI) return;

// Save the current canvas before switching tabs
Expand All @@ -147,8 +147,10 @@ const PadsDialog: React.FC<PadsDialogProps> = ({
// Load the pad data
loadPadData(excalidrawAPI, pad.id, pad.data);

// Close the dialog
handleClose();
// Close the dialog only if keepDialogOpen is false
if (!keepDialogOpen) {
handleClose();
}
};

// Format date function
Expand Down