Skip to content

Commit

Permalink
fixed clear bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sudhirVoid committed Dec 13, 2024
1 parent cb9e49b commit 3c62e44
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/EditorHeader/ControlPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ export default function ControlPanel({
title: t("clear"),
message: t("are_you_sure_clear"),
},
function: () => {
function: async () => {
setTables([]);
setRelationships([]);
setAreas([]);
Expand All @@ -1119,6 +1119,20 @@ export default function ControlPanel({
setTypes([]);
setUndoStack([]);
setRedoStack([]);

if (!diagramId) {
console.error("Something went wrong.");
return;
}

db.table("diagrams")
.delete(diagramId)
.then(() => {
console.info('Deleted diagram successfully.')
})
.catch((error) => {
console.error(`Error deleting records with gistId '${diagramId}':`, error);
});
},
},
edit: {
Expand Down

0 comments on commit 3c62e44

Please sign in to comment.