Skip to content

Commit

Permalink
fix: refresh Klipper objects on klippy connect
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed Oct 15, 2024
1 parent e567cc5 commit abfcc60
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/store/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,24 @@ export const actions: ActionTree<ServerState, RootState> = {
SocketActions.machineProcStats()
SocketActions.machineSystemInfo()

const klippyConnectedNow = (
payload.klippy_connected &&
!state.info.klippy_connected
)

commit('setServerInfo', payload)

dispatch('checkMoonrakerMinVersion')

if (payload.klippy_state !== 'ready') {
// If klippy is not connected, we'll continue to
// retry the init process.
if (state.klippy_retries === 0) dispatch('initComponents', payload)
if (state.klippy_retries === 0) {
dispatch('initComponents', payload)
}
if (klippyConnectedNow) {
SocketActions.printerObjectsList()
}
commit('setKlippyRetries', state.klippy_retries + 1)
clearTimeout(retryTimeout)
retryTimeout = window.setTimeout(() => {
Expand Down

0 comments on commit abfcc60

Please sign in to comment.