mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	reduce unnecessary tab activation events
This commit is contained in:
		| @@ -314,6 +314,10 @@ class AppContext { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     activateTab(tabId) { |     activateTab(tabId) { | ||||||
|  |         if (tabId === this.activeTabId) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         const oldActiveTabId = this.activeTabId; |         const oldActiveTabId = this.activeTabId; | ||||||
|  |  | ||||||
|         this.activeTabId = tabId; |         this.activeTabId = tabId; | ||||||
|   | |||||||
| @@ -44,7 +44,6 @@ class TabContext extends Component { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (notePath === this.notePath) { |         if (notePath === this.notePath) { | ||||||
|             console.log(`Setting existing notePath ${notePath} so ignoring ...`); |  | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export default class Component { | |||||||
|     async eventReceived(name, data, sync = false) { |     async eventReceived(name, data, sync = false) { | ||||||
|         await this.initialized; |         await this.initialized; | ||||||
|  |  | ||||||
|         console.log(`Received ${name} to ${this.componentId}`); | //        console.log(`Received ${name} to ${this.componentId}`); | ||||||
|  |  | ||||||
|         const fun = this[name + 'Listener']; |         const fun = this[name + 'Listener']; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -218,6 +218,10 @@ export default class BookTypeWidget extends TypeWidget { | |||||||
|     async renderIntoElement(note, $container) { |     async renderIntoElement(note, $container) { | ||||||
|         const childNotes = await note.getChildNotes(); |         const childNotes = await note.getChildNotes(); | ||||||
|  |  | ||||||
|  |         if (childNotes.length === 0) { | ||||||
|  |             this.$help.show(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         for (const childNote of childNotes) { |         for (const childNote of childNotes) { | ||||||
|             const childNotePath = this.tabContext.notePath + '/' + childNote.noteId; |             const childNotePath = this.tabContext.notePath + '/' + childNote.noteId; | ||||||
|  |  | ||||||
| @@ -246,10 +250,6 @@ export default class BookTypeWidget extends TypeWidget { | |||||||
|  |  | ||||||
|             $container.append($card); |             $container.append($card); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (childNotes.length === 0) { |  | ||||||
|             this.$help.show(); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @return {boolean} true if this is "auto book" activated (empty text note) and not explicit book note */ |     /** @return {boolean} true if this is "auto book" activated (empty text note) and not explicit book note */ | ||||||
| @@ -276,10 +276,7 @@ export default class BookTypeWidget extends TypeWidget { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     getContent() { |     getContent() {} | ||||||
|         // for auto-book cases when renaming title there should be content |  | ||||||
|         return ""; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user