mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 07:07:13 -05:00
Fix browser error on deleted notes
This commit is contained in:
parent
06d322aca4
commit
8cf3dee351
1 changed files with 23 additions and 9 deletions
|
|
@ -404,10 +404,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
async function updateCurrentNote() {
|
async function updateCurrentNote() {
|
||||||
if (mode !== "add") {
|
if (mode !== "add") {
|
||||||
await updateEditorNote({
|
try {
|
||||||
notes: [note!],
|
await updateEditorNote(
|
||||||
skipUndoEntry: false,
|
{
|
||||||
});
|
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") {
|
if (mode === "add") {
|
||||||
setNote(await newNote({ ntid: notetype.id }));
|
setNote(await newNote({ ntid: notetype.id }));
|
||||||
} else {
|
} else {
|
||||||
setNote(
|
try {
|
||||||
await getNote({
|
let n = await getNote(
|
||||||
nid: nid!,
|
{
|
||||||
}),
|
nid: nid!,
|
||||||
);
|
},
|
||||||
|
{ alertOnError: false },
|
||||||
|
);
|
||||||
|
setNote(n);
|
||||||
|
} catch {
|
||||||
|
console.log("Note deleted", nid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (originalNoteId) {
|
if (originalNoteId) {
|
||||||
const originalNote = await getNote({
|
const originalNote = await getNote({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue