Open Azurewarth0920 opened 1 year ago
Name | Link |
---|---|
Latest commit | a59d5cd57e9b1d03b0d07e822edd8baef4cda572 |
Latest deploy log | https://app.netlify.com/sites/vuex-docs/deploys/639f187915d2550009d98d30 |
Deploy Preview | https://deploy-preview-2201--vuex-docs.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Hi! @kiaking @posva
I think this PR may fix the broken feature in v4.1.0. if you have time, can you review this PR?
@Azurewarth0920 Hi! There may be a problem with the unregisterModule function.
@1085383233
https://github.com/vuejs/vuex/pull/2201#issuecomment-1350325599
Hi! Can you provide a test case about the problem?
@1085383233
Hi! There may be a problem with the unregisterModule function.
Is the ReactiveEffect
with the module kept alive even if the module is unregistered?
@1085383233
Hi! There may be a problem with the unregisterModule function.
Is the
ReactiveEffect
with the module kept alive even if the module is unregistered?
@Azurewarth0920 Yeah, but I didn't test it.
Any news on this?
The bug is really a bummer.
@catalin-bratu This PR is waiting for reviews.
At this time, the workaround for my project is that downgrade the vuex to v4.0.2.
@Azurewarth0920 is there any known bug for this fix you want to merge? any updates on this?
@kiaking any word on this?
~I've raised an alternative solution in https://github.com/vuejs/vuex/pull/2234~
I've closed my alternative solution, which fails this test case:
it('module: computed getter should be reactive after module unregistration', () => {
const store = new Vuex.Store({
state: {
foo: 0
},
getters: {
getFoo: state => state.foo
},
mutations: {
incrementFoo: state => state.foo++
}
})
const computedFoo = computed(() => store.getters.getFoo)
store.commit('incrementFoo')
expect(computedFoo.value).toBe(1)
store.registerModule('bar', {
state: {
bar: 0
}
})
store.unregisterModule('bar')
store.commit('incrementFoo')
expect(computedFoo.value).toBe(2)
})
@Azurewarth0920 do you think it's worth adding this test case to your PR? (Your code passes it 👏🏼 )
close: #2197
The computed getters will be unreactive after registering modules,
Approach:
When stopping effectScope, only stop the effect that has no dependencies.