From 60d07a68718cb2a8d7ec29e35b40b1a0267a86b5 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 8 Feb 2020 17:44:34 +0100 Subject: [PATCH] fix duplicated cached widgets --- electron.js | 1 + src/public/javascripts/widgets/calendar.js | 6 ------ .../javascripts/widgets/tab_caching_widget.js | 14 +++++++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/electron.js b/electron.js index fbaea6758..2a20bbbb6 100644 --- a/electron.js +++ b/electron.js @@ -44,6 +44,7 @@ app.on('will-quit', () => { globalShortcut.unregisterAll(); }); +// this is to disable electron warning spam in the dev console (local development only) process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'; require('./src/www'); diff --git a/src/public/javascripts/widgets/calendar.js b/src/public/javascripts/widgets/calendar.js index 73a4277a8..bade437fe 100644 --- a/src/public/javascripts/widgets/calendar.js +++ b/src/public/javascripts/widgets/calendar.js @@ -38,12 +38,6 @@ export default class CalendarWidget extends CollapsibleWidget { console.log("set tab context", tabContext.tabId, "to", this.componentId); } - async refresh() { - super.refresh(); - - //console.trace("tab", this.tabContext.tabId); - } - async doRenderBody() { await libraryLoader.requireLibrary(libraryLoader.CALENDAR_WIDGET); diff --git a/src/public/javascripts/widgets/tab_caching_widget.js b/src/public/javascripts/widgets/tab_caching_widget.js index 5089d47d6..17a5b73f4 100644 --- a/src/public/javascripts/widgets/tab_caching_widget.js +++ b/src/public/javascripts/widgets/tab_caching_widget.js @@ -13,6 +13,14 @@ export default class TabCachingWidget extends TabAwareWidget { return this.$widget; } + activeTabChangedListener(param) { + super.activeTabChangedListener(param); + + // stop propagation of the event to the children, individual tab widget should not know about tab switching + // since they are per-tab + return false; + } + refreshWithNote() { for (const widget of Object.values(this.widgets)) { widget.toggle(false); @@ -28,17 +36,13 @@ export default class TabCachingWidget extends TabAwareWidget { if (!widget) { widget = this.widgets[this.tabContext.tabId] = this.widgetFactory(); - this.children.push(widget); + this.children.push(widget);console.log("Creating widget",widget.componentId,"for", this.tabContext.tabId); this.$widget.after(widget.render()); widget.eventReceived('setTabContext', {tabContext: this.tabContext}); } widget.toggle(true); - - // stop propagation of the event to the children, individual tab widget should not know about tab switching - // since they are per-tab - return false; } tabRemovedListener({tabId}) {