From 64828e3b06390db34303b053651b4c3d84fa3382 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 17 Nov 2022 14:18:17 +0000 Subject: [PATCH] Close side panel whenever screen changes --- packages/client/src/stores/sidePanel.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/client/src/stores/sidePanel.js b/packages/client/src/stores/sidePanel.js index 327fcfae82..5de2b679a1 100644 --- a/packages/client/src/stores/sidePanel.js +++ b/packages/client/src/stores/sidePanel.js @@ -1,4 +1,5 @@ import { writable, derived } from "svelte/store" +import { screenStore } from "./screens.js" export const createSidePanelStore = () => { const initialState = { @@ -35,3 +36,11 @@ export const createSidePanelStore = () => { } export const sidePanelStore = createSidePanelStore() + +// Close side panel every time we change screen +const activeScreenId = derived(screenStore, $screenStore => { + return $screenStore?.activeScreen?._id +}) +activeScreenId.subscribe(() => { + sidePanelStore.actions.close() +})