Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(maintenance): add init store entry to init maintenance store only one time #1914

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/store/gui/maintenance/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export const actions: ActionTree<GuiMaintenanceState, RootState> = {
// 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
}

Expand Down Expand Up @@ -92,7 +100,12 @@ export const actions: ActionTree<GuiMaintenanceState, RootState> = {

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]
rackrick marked this conversation as resolved.
Show resolved Hide resolved

await commit('initStore', entries)
await dispatch('socket/removeInitModule', 'gui/maintenance/init', { root: true })
},

Expand Down
2 changes: 1 addition & 1 deletion src/store/gui/maintenance/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const mutations: MutationTree<GuiMaintenanceState> = {
},

initStore(state, payload) {
Vue.set(state, 'entries', payload.value)
Vue.set(state, 'entries', payload)
},

store(state, payload) {
Expand Down
Loading