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

Mutations are showing out of order when committing actions from a plugin #678

Open
DarynHolmes opened this issue Apr 25, 2018 · 2 comments · Fixed by vuejs/vuex#1358 · May be fixed by rpocklin/phoenix#2
Open

Mutations are showing out of order when committing actions from a plugin #678

DarynHolmes opened this issue Apr 25, 2018 · 2 comments · Fixed by vuejs/vuex#1358 · May be fixed by rpocklin/phoenix#2
Labels

Comments

@DarynHolmes
Copy link

DarynHolmes commented Apr 25, 2018

Version

4.1.4

Browser and OS info

Version 65.0.3325.181 (Official Build) (64-bit) - Windows 10

Steps to reproduce

When calling an action from a Vuex plugin, the order of the mutations are listed out of order in Vue Devtools. The log statements from the built-in logger seem correct, but the list in Devtools is incorrect.

This can be replicated by running the code in this repo: https://github.com/DarynHolmes/vue-devtools-order

Run that with: npm run serve
Click the button: Add Error
Compare the output from the built-in vuex logger to the Vue devtools display of mutations.

What is expected?

Base State

addError

removeError

What is actually happening?

Base State

removeError

addError


It appears that the Dev Tools are not using enough precision when ordering by time.

@Akryum Akryum added bug need team repro We acknowledged your report and will soon try to reproduce it labels Jul 25, 2018
@simplesmiler
Copy link
Member

Confirmed that this happens with the latest beta.

@simplesmiler
Copy link
Member

Happens because devtools adds its subscriber after the application subscribers are added.

  1. Mutation A goes through the application subscriber, and subscriber commits mutation B.
  2. Mutation B goes through the application subscriber, nothing interesting happens.
  3. Mutation B goes through the devtools subscriber, gets added to history.
  4. Mutation A goes through the devtools subscriber, gets added to history.

The solution would be to prepend the devtools subscriber, so it would be the first in the chain. Currently vuex does not have an API to prepend subscribers.

simplesmiler added a commit to simplesmiler/vuex that referenced this issue Jul 31, 2018
@simplesmiler simplesmiler removed the need team repro We acknowledged your report and will soon try to reproduce it label Jul 31, 2018
ktsn added a commit to vuejs/vuex that referenced this issue Apr 23, 2020
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
@dependabot dependabot bot linked a pull request Mar 17, 2021 that will close this issue
freedeveloper000 added a commit to freedeveloper000/vuex that referenced this issue Feb 28, 2022
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
OneDev0411 added a commit to OneDev0411/Vuex that referenced this issue May 5, 2022
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
topstack1226 pushed a commit to topstack1226/hospital-frontend that referenced this issue Jan 3, 2023
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
humilitypatience added a commit to humilitypatience/vue-workspace that referenced this issue May 21, 2023
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
ZinedineDumas added a commit to ZinedineDumas/Vue-Vuex that referenced this issue Jul 17, 2023
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
sphinxDevVic added a commit to sphinxDevVic/vuex that referenced this issue Feb 11, 2024
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
profreelancer222 added a commit to profreelancer222/VueSocial that referenced this issue Feb 20, 2024
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
UltraDEV007 added a commit to UltraDEV007/vuex_project that referenced this issue Apr 26, 2024
* Add prepend option to subscribe

* Prepend devtools subscribe handler to fix vuejs/devtools#678

Co-authored-by: Katashin <ktsn55@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants