Skip to content

Commit 3c95e51

Browse files
authored
Delete diagram on clear (#321)
1 parent afb3b60 commit 3c95e51

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/components/EditorHeader/ControlPanel.jsx

+15-1
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ export default function ControlPanel({
11901190
title: t("clear"),
11911191
message: t("are_you_sure_clear"),
11921192
},
1193-
function: () => {
1193+
function: async () => {
11941194
setTables([]);
11951195
setRelationships([]);
11961196
setAreas([]);
@@ -1199,6 +1199,20 @@ export default function ControlPanel({
11991199
setTypes([]);
12001200
setUndoStack([]);
12011201
setRedoStack([]);
1202+
1203+
if (!diagramId) {
1204+
console.error("Something went wrong.");
1205+
return;
1206+
}
1207+
1208+
db.table("diagrams")
1209+
.delete(diagramId)
1210+
.then(() => {
1211+
console.info('Deleted diagram successfully.')
1212+
})
1213+
.catch((error) => {
1214+
console.error(`Error deleting records with gistId '${diagramId}':`, error);
1215+
});
12021216
},
12031217
},
12041218
edit: {

0 commit comments

Comments
 (0)