Skip to content

Commit

Permalink
fix: Klipper reset should only reset its own state
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
pedrolamas committed Nov 5, 2022
1 parent 893ae30 commit 06d81c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mixins/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default class ServicesMixin extends Vue {
*/
async _klipperReset () {
this.$store.commit('socket/setAcceptNotifications', false)
await this.$store.dispatch('server/resetKlippy', undefined, { root: true })
await this.$store.dispatch('reset', [
'server',
'printer',
'charts',
'wait'
Expand Down
4 changes: 4 additions & 0 deletions src/store/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const actions: ActionTree<ServerState, RootState> = {
commit('setReset')
},

async resetKlippy ({ commit }) {
commit('setResetKlippy')
},

/**
* Init moonraker components.
* During app init, we want to initially init these once, irrelevant
Expand Down
9 changes: 9 additions & 0 deletions src/store/server/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ export const mutations: MutationTree<ServerState> = {
Object.assign(state, defaultState())
},

setResetKlippy (state) {
const { klippy_retries, info } = defaultState()

Object.assign(state, {
klippy_retries,
info
})
},

setServerInfo (state, payload) {
Vue.set(state, 'info', payload)
},
Expand Down

0 comments on commit 06d81c5

Please sign in to comment.