fixes to note loading. Sidebar flickers way less after note change

This commit is contained in:
zadam
2019-09-04 22:45:12 +02:00
parent a17b8a053e
commit 135102d2b5
4 changed files with 34 additions and 20 deletions

View File

@@ -374,20 +374,11 @@ tabRow.addListener('activeTabChange', async ({ detail }) => {
tabRow.addListener('tabRemove', async ({ detail }) => {
const tabId = detail.tabEl.getAttribute('data-tab-id');
const tabContextToDelete = tabContexts.find(nc => nc.tabId === tabId);
if (tabContextToDelete) {
// sometimes there are orphan autocompletes after closing the tab
tabContextToDelete.closeAutocomplete();
await tabContextToDelete.saveNoteIfChanged();
tabContextToDelete.$tabContent.remove();
}
tabContexts.filter(nc => nc.tabId === tabId)
.forEach(tc => tc.remove());
tabContexts = tabContexts.filter(nc => nc.tabId !== tabId);
console.log(`Removed tab ${tabId}`);
if (tabContexts.length === 0) {
openEmptyTab();
}