-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Getters - Reactivity broken after registering new module #2197
Comments
Experiencing the same issue, the problem is the replacement and stopping of This stops currently active effectScope ( A workaround (non-feasible, but still) is to subscribe to
@kiaking @posva (since you originally added and reviewed this in #1883) unless I'm missing something the replacement of EDIT: Ah I see the entire state is also replaced, therefore all computed-wrapped getters need to be reinitialized too. But any existing effect linked to a store getter will then stop working, as it will still be linked to previous (now inactive) computed-wrapped getter. |
Any ETA till this bug will get fixed? |
This is a serious regression. |
same problem |
We're in the same boat, we narrowed it down to this change in resetStoreState as well Object.defineProperty(store.getters, key, {
/*good->*/ get: () => computedObj[key](),
/*bad->*/ // get: () => computedCache[key].value,
enumerable: true // for local getters
}); Interestingly enough any modules registered after the initial store still work without issue. We are rolling back to 4.0.2 for now. |
Same problem here, this is really annoying |
Same problem for me - Vue 3.3.4 + Vuex 4.1.0. Thank you @jaredplowman for the tip with downgrading package. It solves this particular issue. |
Fixes vuejs#2197 At the moment, when registering a dynamic module, we call `resetStoreState()` just to register the getters for the new module. It seems unnecessary to reset the entire store state in this case, and this actually also leads to [other issues][1]. This change is based on the test case added in vuejs#2201 The approach taken in this change is to refactor the getter registration into its own function, and call that new method when registering a dynamic module instead of resetting the store state. [1]: vuejs#2197
Fixes vuejs#2197 At the moment, when registering a dynamic module, we call `resetStoreState()` just to register the getters for the new module. It seems unnecessary to reset the entire store state in this case, and this actually also leads to [other issues][1]. This change is based on the test case added in vuejs#2201 The approach taken in this change is to refactor the getter registration into its own function, and call that new method when registering a dynamic module instead of resetting the store state. [1]: vuejs#2197
Fixes vuejs#2197 At the moment, when registering a dynamic module, we call `resetStoreState()` just to register the getters for the new module. It seems unnecessary to reset the entire store state in this case, and this actually also leads to [other issues][1]. This change is based on the test case added in vuejs#2201 The approach taken in this change is to refactor the getter registration into its own function, and call that new method when registering a dynamic module instead of resetting the store state. [1]: vuejs#2197
Tracking the issue from #2217 |
Just stumbled upon this. A coworker upgraded the package while I was doing a feature branch, had a mini panic attack when sync and a lot of things suddenly stopped working after visiting a very specific view — the one with dynamic modules. Rollback to I understand that Thanks OP et al 🙏 |
ANY updates?!?! this is actually a BIG issue. |
Recently, I have been migrating to
|
你的邮件我已收到!
|
Version
Vue: 3.2.45
Vuex: 4.1.0
Reproduction link
https://github.com/lordolive/vuex4-getters-reactivity
Steps to reproduce
Then in website :
What is expected?
The getter reactivity should still work and the count in the button should increment.
What is actually happening?
The getter accessed before the call to this.$store.registerModule() is no longer reactive, but the one that was not accessed before is still reactive
Additionnal comments
I first tried with MapGetters and had the same problem.
Using $store.getters.count directly in the template solve the issue, but in my real application with multiple modules it is simply not pratical, especially considering that we are migrating a lot of code from Vue 2 which was working with mapGetters.
The text was updated successfully, but these errors were encountered: