From 1d8fa9d6165991401d419992ff604e7f21d12055 Mon Sep 17 00:00:00 2001 From: Antonio Anaya Date: Fri, 8 May 2026 10:44:30 -0600 Subject: [PATCH 1/4] bugfix(eventbus) Unwrap arrow functions and close eventbus signals --- webapp/src/components/appContent.vue | 30 +++++++++++++------ .../tabContentComponents/streamContent.vue | 2 ++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/webapp/src/components/appContent.vue b/webapp/src/components/appContent.vue index 29af3e5e..fb88a92a 100644 --- a/webapp/src/components/appContent.vue +++ b/webapp/src/components/appContent.vue @@ -199,23 +199,35 @@ export default { mounted() { const store = useSettingsStore(); // A global signal listener to switch tab - eventBus.on("globalSwitchTab", (tabID) => { - this.currentTab = tabID; - }); + eventBus.on("globalSwitchTab", this.handleGlobalSwitchTab); // A global signal listener to increment tab - eventBus.on("globalIncrementTab", () => { - this.incrementTabBy(1); - }); + eventBus.on("globalIncrementTab", this.handleGlobalIncrementTab); // A global signal listener to decrement tab - eventBus.on("globalDecrementTab", () => { - this.incrementTabBy(-1); - }); + eventBus.on("globalDecrementTab", this.handleGlobalDecrementTab); if (store.ready) { this.startModals(); } }, + beforeUnmount() { + // closing signals + eventBus.off("globalSwitchTab", this.handleGlobalSwitchTab); + eventBus.off("globalIncrementTab", this.handleGlobalIncrementTab); + eventBus.off("globalDecrementTab", this.handleGlobalDecrementTab); + }, + methods: { + // This methods replace the previous arrow function calls "() => {}". + // This is needed for closing actual same opening functions. + handleGlobalSwitchTab: function (tabID) { + this.currentTab = tabID; + }, + handleGlobalIncrementTab: function () { + this.incrementTabBy(1); + }, + handleGlobalDecrementTab: function () { + this.incrementTabBy(-1); + }, setTab: function (event, tab) { if (!(this.currentTab == tab)) { this.currentTab = tab; diff --git a/webapp/src/components/tabContentComponents/streamContent.vue b/webapp/src/components/tabContentComponents/streamContent.vue index d20e05c6..753a8fa8 100644 --- a/webapp/src/components/tabContentComponents/streamContent.vue +++ b/webapp/src/components/tabContentComponents/streamContent.vue @@ -109,6 +109,8 @@ export default { this.sizeObserver.disconnect(); // Remove from the array of active streams this.store.removeStream(this.$.uid); + // close signal + eventBus.off("globalFlashStream", this.onFlashStream); }, methods: { From 567cff35687499352d1206b972d17667ca458c59 Mon Sep 17 00:00:00 2001 From: Antonio Anaya Date: Sat, 9 May 2026 04:31:27 -0600 Subject: [PATCH 2/4] chore(node) add comments for signals management description --- webapp/src/App.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webapp/src/App.vue b/webapp/src/App.vue index 75b37e9b..5d06de65 100644 --- a/webapp/src/App.vue +++ b/webapp/src/App.vue @@ -186,7 +186,7 @@ export default { shortcut: "pgup / pgdn", description: "Move the microscope focus", }); - + // The following signal is managed (on/off) by actionButton.vue at this.submitOnEvent. Mousetrap.bind("c", () => { eventBus.emit("globalCaptureEvent", {}); }); @@ -194,7 +194,8 @@ export default { shortcut: "c", description: "Take a capture", }); - + // The following signal is managed (on/off) by actionButton.vue at this.submitOnEvent. + // There's no visual feedback when the event is triggered Mousetrap.bind("a", () => { eventBus.emit("globalFastAutofocusEvent", {}); }); @@ -202,10 +203,11 @@ export default { shortcut: "a", description: "Fast autofocus", }); - + // This signal is managed on lifecycle mounted and unmounted optionsAPI at appContent.vue. Mousetrap.bind("shift+down", () => { eventBus.emit("globalIncrementTab", {}); }); + // This signal is managed on lifecycle mounted and unmounted optionsAPI at appContent.vue. Mousetrap.bind("shift+up", () => { eventBus.emit("globalDecrementTab", {}); }); From 27f09b91bbd829f0d7dc92166d82b9a25995d6f0 Mon Sep 17 00:00:00 2001 From: Antonio Anaya Date: Mon, 11 May 2026 12:43:34 +0000 Subject: [PATCH 3/4] Apply suggestions from code review of branch bugfix/close_mitt_signals_ Co-authored-by: Julian Stirling --- webapp/src/components/appContent.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webapp/src/components/appContent.vue b/webapp/src/components/appContent.vue index fb88a92a..c977219a 100644 --- a/webapp/src/components/appContent.vue +++ b/webapp/src/components/appContent.vue @@ -217,8 +217,9 @@ export default { }, methods: { - // This methods replace the previous arrow function calls "() => {}". - // This is needed for closing actual same opening functions. + // These methods are used for opening and closing signals. + // They are used instead of anonymous arrow functions so we can + // call close on the same function called with open. handleGlobalSwitchTab: function (tabID) { this.currentTab = tabID; }, From 0d2fb9de0b3218343480e863dc1299cacb322f38 Mon Sep 17 00:00:00 2001 From: Antonio Anaya Date: Mon, 11 May 2026 07:06:00 -0600 Subject: [PATCH 4/4] bugfix(actionButton) Unwrap arrow function at submitOnEvent --- .../components/labThingsComponents/actionButton.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webapp/src/components/labThingsComponents/actionButton.vue b/webapp/src/components/labThingsComponents/actionButton.vue index deb2f2d2..6b173d62 100644 --- a/webapp/src/components/labThingsComponents/actionButton.vue +++ b/webapp/src/components/labThingsComponents/actionButton.vue @@ -219,22 +219,22 @@ export default { } // A global signal listener to perform the action if (this.submitOnEvent) { - eventBus.on(this.submitOnEvent, () => { - if (this.isDisabled) return; - // Bootstrap task if button is not disabled. - this.bootstrapTask(); - }); + eventBus.on(this.submitOnEvent, this.handleShortcutTrigger); } } }, beforeUnmount() { if (this.submitOnEvent) { - eventBus.off(this.submitOnEvent); + eventBus.off(this.submitOnEvent, this.handleShortcutTrigger); } }, methods: { + handleShortcutTrigger() { + if (this.isDisabled) return; + this.bootstrapTask(); + }, handleClick() { if (this.taskStarted) { this.terminateTask();