refactor: 💡 Fix ts error

This commit is contained in:
Jin
2025-03-18 18:44:48 +01:00
parent e12be14dc9
commit b18cfb5d20
5 changed files with 27 additions and 8 deletions

View File

@@ -115,7 +115,10 @@ export default class RecentChangesDialog extends BasicWidget {
await ws.waitForMaxKnownEntityChangeId();
appContext.tabManager.getActiveContext().setNote(change.noteId);
const activeContext = appContext.tabManager.getActiveContext();
if (activeContext) {
activeContext.setNote(change.noteId);
}
}
});
@@ -141,7 +144,10 @@ export default class RecentChangesDialog extends BasicWidget {
// Skip clicks on the link or deleted notes
if (e.target?.nodeName !== "A" && !change.current_isDeleted) {
// Open the current note
appContext.tabManager.getActiveContext().setNote(change.noteId);
const activeContext = appContext.tabManager.getActiveContext();
if (activeContext) {
activeContext.setNote(change.noteId);
}
}
})
.toggleClass("deleted-note", !!change.current_isDeleted)