Delete diagram on clear (#321)

This commit is contained in:
sudhir 2025-04-20 03:27:38 +05:30 committed by GitHub
parent afb3b60123
commit 3c95e51f06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1190,7 +1190,7 @@ export default function ControlPanel({
title: t("clear"),
message: t("are_you_sure_clear"),
},
function: () => {
function: async () => {
setTables([]);
setRelationships([]);
setAreas([]);
@ -1199,6 +1199,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: {