reduce unnecessary tab activation events

This commit is contained in:
zadam 2020-01-25 10:25:06 +01:00
parent 3254b551d8
commit 52a907651e
4 changed files with 10 additions and 10 deletions

View file

@ -314,6 +314,10 @@ class AppContext {
}
activateTab(tabId) {
if (tabId === this.activeTabId) {
return;
}
const oldActiveTabId = this.activeTabId;
this.activeTabId = tabId;

View file

@ -44,7 +44,6 @@ class TabContext extends Component {
}
if (notePath === this.notePath) {
console.log(`Setting existing notePath ${notePath} so ignoring ...`);
return;
}

View file

@ -11,7 +11,7 @@ export default class Component {
async eventReceived(name, data, sync = false) {
await this.initialized;
console.log(`Received ${name} to ${this.componentId}`);
// console.log(`Received ${name} to ${this.componentId}`);
const fun = this[name + 'Listener'];

View file

@ -218,6 +218,10 @@ export default class BookTypeWidget extends TypeWidget {
async renderIntoElement(note, $container) {
const childNotes = await note.getChildNotes();
if (childNotes.length === 0) {
this.$help.show();
}
for (const childNote of childNotes) {
const childNotePath = this.tabContext.notePath + '/' + childNote.noteId;
@ -246,10 +250,6 @@ export default class BookTypeWidget extends TypeWidget {
$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 */
@ -276,10 +276,7 @@ export default class BookTypeWidget extends TypeWidget {
}
}
getContent() {
// for auto-book cases when renaming title there should be content
return "";
}
getContent() {}
focus() {}