From 78fac5f13728882eec502ef1575ed194a43da12d Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 16 Jun 2024 19:02:14 +0200 Subject: [PATCH] fix(maintenance): add init store entry to init maintenance store only one time Signed-off-by: Stefan Dej --- src/store/gui/maintenance/actions.ts | 15 ++++++++++++++- src/store/gui/maintenance/mutations.ts | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/store/gui/maintenance/actions.ts b/src/store/gui/maintenance/actions.ts index 3205bcba2..1f3530dff 100644 --- a/src/store/gui/maintenance/actions.ts +++ b/src/store/gui/maintenance/actions.ts @@ -36,6 +36,14 @@ export const actions: ActionTree = { // stop, when no entries are available/found const entries = defaults.entries ?? [] if (entries?.length === 0) { + Vue.$socket.emit('server.database.post_item', { + namespace: 'maintenance', + key: uuidv4(), + value: { + name: 'MAINTENANCE_INIT', + }, + }) + return } @@ -92,7 +100,12 @@ export const actions: ActionTree = { async initStore({ commit, dispatch }, payload) { await commit('reset') - await commit('initStore', payload) + + const entries = payload.value ?? {} + const initKey = Object.keys(entries).find((key) => entries[key]?.name === 'MAINTENANCE_INIT') + if (initKey) delete entries[initKey] + + await commit('initStore', entries) await dispatch('socket/removeInitModule', 'gui/maintenance/init', { root: true }) }, diff --git a/src/store/gui/maintenance/mutations.ts b/src/store/gui/maintenance/mutations.ts index 7f9dee174..e7d559d9a 100644 --- a/src/store/gui/maintenance/mutations.ts +++ b/src/store/gui/maintenance/mutations.ts @@ -9,7 +9,7 @@ export const mutations: MutationTree = { }, initStore(state, payload) { - Vue.set(state, 'entries', payload.value) + Vue.set(state, 'entries', payload) }, store(state, payload) {