diff --git a/web/app/src/stores/socket-status.js b/web/app/src/stores/socket-status.js index fdc6fbf2..e9764280 100644 --- a/web/app/src/stores/socket-status.js +++ b/web/app/src/stores/socket-status.js @@ -1,13 +1,6 @@ import { defineStore } from 'pinia' import { useNotifs } from '@/stores/notifications' -// Not sure if this is the best way to deal with those notifications. It feels a -// bit spaghetto to have one Pinia store influence another. Maybe move this to -// the app level once the Workers and Settings views are fleshed out. Maybe -// that'll cause the Notifications popover to be handled at the app-global -// level, instead of per view, creating a better place to put this logic. -const notifs = useNotifs(); - /** * Status of the SocketIO/Websocket connection to Flamenco Manager. */ @@ -30,7 +23,7 @@ export const useSocketStatus = defineStore('socket-status', { // Only patch the state if it actually will change. if (!this.isConnected) return; - notifs.add(`Connection to Flamenco Manager lost`); + this._get_notifs().add(`Connection to Flamenco Manager lost`); this.$patch({ isConnected: false, wasEverDisconnected: true, @@ -46,11 +39,20 @@ export const useSocketStatus = defineStore('socket-status', { return; if (this.wasEverDisconnected) - notifs.add("Connection to Flamenco Manager established"); + this._get_notifs().add("Connection to Flamenco Manager established"); this.$patch({ isConnected: true, message: "", }); }, + + _get_notifs() { + // Not sure if this is the best way to deal with those notifications. It feels a + // bit spaghetto to have one Pinia store influence another. Maybe move this to + // the app level once the Workers and Settings views are fleshed out. Maybe + // that'll cause the Notifications popover to be handled at the app-global + // level, instead of per view, creating a better place to put this logic. + return useNotifs(); + } } })