From 877c7ee8617be45e2d88deb72ac3d6849d513a4c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 7 Nov 2021 16:29:38 +0100 Subject: [PATCH] refactor: use Vue.set in addClosePanel and removeClosePanel mutations Signed-off-by: Stefan Dej --- src/store/gui/mutations.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/store/gui/mutations.ts b/src/store/gui/mutations.ts index 970b37a0..d69cb7e1 100644 --- a/src/store/gui/mutations.ts +++ b/src/store/gui/mutations.ts @@ -123,13 +123,23 @@ export const mutations: MutationTree = { }, addClosePanel(state, payload) { - const exist = state.dashboard.nonExpandPanels?.includes(payload.name) ?? false - if (!exist) state.dashboard.nonExpandPanels.push(payload.name) + const nonExpandPanels = [...state.dashboard.nonExpandPanels] + + if (!nonExpandPanels.includes(payload.name)) { + nonExpandPanels.push(payload.name) + + Vue.set(state.dashboard, 'nonExpandPanels', nonExpandPanels) + } }, removeClosePanel(state, payload) { - const index = state.dashboard.nonExpandPanels.indexOf(payload.name) - if (index > -1) state.dashboard.nonExpandPanels.splice(index, 1) + const nonExpandPanels = [...state.dashboard.nonExpandPanels] + const index = nonExpandPanels.indexOf(payload.name) + if (index > -1) { + nonExpandPanels.splice(index, 1) + + Vue.set(state.dashboard, 'nonExpandPanels', nonExpandPanels) + } }, storeMacrogroup(state, payload) {