vuex icon indicating copy to clipboard operation
vuex copied to clipboard

silent and ignore any dispatch or commit during time-traveling in the dev mode

Open leoyli opened this issue 7 years ago • 0 comments

What problem does this feature solve?

IMO, time-traveling (or traversing in the event sourcing record) should have no side-effects. Often, I found it is annoying when I "time-traveled", there is a side-effect being performed due to the component life cycle or routing middleware try to do their "regular" task... this resulted in a polluted mutation records... Consider the fact that some component can be delayed rendered by v-if=state (so components may be mounted/unmounted during time-traveling), the same may also happen if the one uses @vue/vuex-router-sync, this feature is good to have.

What does the proposed API look like?

When we click "time travel to the state" in the dev tool, Vuex internally have a mechanism to silent and ignore any dispatch or commit to be performed (or prevent state to be mutated during time-traveling). This locking mechanism can be unlocked if we decide to either revert or traverse to the latest state (they are basically the same). While I have little clue how we are going to implement this or should we have this, after discussed with my colleagues, I think it would be beneficial to open this discussion.

** the reason I post this here is due to the fact that the devTool have to touch the vuex core if we want to have this.

leoyli avatar Nov 29 '18 01:11 leoyli