Fix browser error on deleted notes

This commit is contained in:
Abdo 2025-08-30 16:06:55 +03:00
parent 06d322aca4
commit 8cf3dee351

View file

@ -404,10 +404,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
async function updateCurrentNote() {
if (mode !== "add") {
await updateEditorNote({
try {
await updateEditorNote(
{
notes: [note!],
skipUndoEntry: false,
});
},
{ alertOnError: false },
);
} catch {
console.log("Note deleted", note!.id);
}
}
}
@ -1003,11 +1010,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
if (mode === "add") {
setNote(await newNote({ ntid: notetype.id }));
} else {
setNote(
await getNote({
try {
let n = await getNote(
{
nid: nid!,
}),
},
{ alertOnError: false },
);
setNote(n);
} catch {
console.log("Note deleted", nid);
return;
}
}
if (originalNoteId) {
const originalNote = await getNote({