refactor: use Vue.set in addClosePanel and removeClosePanel mutations

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-11-07 16:29:38 +01:00
1 parent c6934d751f
commit 877c7ee861
1 file changed
+14 -4
+14 -4
View File
@@ -123,13 +123,23 @@ export const mutations: MutationTree<GuiState> = {
},
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) {