Join GitHub today
Separate instances of Vuex store clash each other when working across separate Vue instances #1462
Steps to reproduce
I am currently learning/prototyping vue.js and vuex (using plain js, at the moment). I am trying to accomplish following:
1)create multiple vue instances having their own vuex stores independent to each other. Right now, I am storing only ajax status/progress in vuex store and improve it gradually.
I almost achieved the above as shown in fiddle:
Theoritically, we can just create one class out of app.js and app2.js (identical code). But, just to test/troubleshoot things, I separated them.
I am able to pull data and everything seems working fine. If I refresh button in second instance the console log shows perfectly. If I refresh button in first instance it clashes with the vuex store in second instance
What is expected?
the vue instance should not clash with other vuex stores not related to it
What is actually happening?
first vue instance clashes with vuex store in second instance
Because you are registering your two
Note that you should not create multiple Vuex instance in the same page since it assumes there is only store instance. Please use module (with