From 1d8fa9d6165991401d419992ff604e7f21d12055 Mon Sep 17 00:00:00 2001 From: Antonio Anaya Date: Fri, 8 May 2026 10:44:30 -0600 Subject: [PATCH] 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: {