mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
disallow removing last tab because of frequent race conditions when done too quickly
This commit is contained in:
parent
5209583a73
commit
ab7d121290
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user