Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
disallow removing last tab because of frequent race conditions when done too quickly
zadamab7d121290ee
diff --git a/src/public/app/services/tab_manager.js b/src/public/app/services/tab_manager.jsindex 45971e331e..d14107ad2a 100644--- a/src/public/app/services/tab_manager.js+++ b/src/public/app/services/tab_manager.js@@ -299,6 +299,16 @@ export default class TabManager extends Component {async removeNoteContext(ntxId) {const noteContextToRemove = this.getNoteContextById(ntxId);+ if (noteContextToRemove.isMainContext()) {+ // forbid removing last main note context+ // this was previously allowed (was replaced with empty tab) but this proved to be prone to race conditions+ const mainNoteContexts = this.getNoteContexts().filter(nc => nc.isMainContext());++ if (mainNoteContexts.length === 1) {+ return;+ }+ }+// close dangling autocompletes after closing the tab$(".aa-input").autocomplete("close");