[Vuejs]-Vuex getter does not return current state value

0👍

Though, this does not solve the actual problem (getter is not updated on commit) – this workaround forces Vuex to re-initialize the entire state.

I have added this code in an axios ajax response handler, which occurs only once per session:

commit('SERVER_DETAILS', data)

$store.hotUpdate($store.state) // <<-- This line is new.

0👍

You are using the Vuex state wrong, it should be an object.

const state = {
  serverDetails: {},
}

Leave a comment