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

lost previous registered module during multiple registration #1878

Closed
musashiM82 opened this issue Nov 20, 2020 · 11 comments
Closed

lost previous registered module during multiple registration #1878

musashiM82 opened this issue Nov 20, 2020 · 11 comments
Assignees
Labels
4.x bug Something isn't working

Comments

@musashiM82
Copy link

Version

4.0.0-rc.1

Reproduction link

https://github.com/musashiM82/register-module-in-before-create-page

Steps to reproduce

  • clone repo
  • execute npm i && npm run serve
  • open web app in browser
  • in "Home" page you can see "state.home.count 1"
  • click on "About" link
  • click on "Home" link
  • in "Home" page you can see "state.home.count" now

What is expected?

it is expected that the second time that I go into Home page I continue to see "state.home.count 1"

What is actually happening?

it is happening that I see "state.home.count". it is like the previous registered module is lost

@kiaking
Copy link
Member

kiaking commented Nov 22, 2020

Confirmed. This is happening due to caching issue. If we revert 0006765 it fixes. I think registering new getters is causing some kind of problem. Not sure what that is yet.

I'll look into it.

@kiaking kiaking self-assigned this Nov 22, 2020
@kiaking kiaking added 4.x bug Something isn't working labels Nov 22, 2020
@kiaking
Copy link
Member

kiaking commented Nov 22, 2020

OK, this is happening because Vue is destroying the computed (Vuex getters) when the component is destroyed (switching the route). Not because of multiple module registration.

We might not have perfect solution until vuejs/rfcs#212 gets merged and issue vuejs/core#1532 gets solved.

Looking into any workaround we could have.

@kiaking
Copy link
Member

kiaking commented Nov 22, 2020

I've opened #1883 with the failing test case.

@vjanssens
Copy link

@kiaking what's the status of this ticket? I think most of the mentioned tickets are either resolved or closed.

@mcrapts
Copy link

mcrapts commented Jan 20, 2022

I honestly think this will never get addressed, Vuex appears to have been abandoned in favor of Pinia, despite it being a first-party package in the Vue namespace on GitHub. This is terrible for anyone trying to migrate from Vue 2 to Vue 3.

@lmiller1990
Copy link
Member

lmiller1990 commented Feb 9, 2022

From the docs

As of Vue 3.0, the getter's result is not cached as the computed property does. This is a known issue that requires Vue 3.1 to be released. You can learn more at PR #1878.

Well 3.1 is out - I wonder if we can fix this now. @kiaking any blocker here? Some good info here #1883 but not entirely clear what needs to happen. I'm sure someone in the community can pick this up - I wonder if we can provide a little list of "next steps" to get this underway.

@lmiller1990
Copy link
Member

Update - 3.2 did not solve this. Kia is busy on other core projects, so, if this is an important issue for you and your project (you as in the reader of the comment), you might need to help out.

Good news is you get to fix a high impact issue! I'd recommend looking at the work in #1883 and getting an idea of what exactly the problem is (I don't know yet) but it looks like we (might) need to patch something in core.

I wonder if we can't do a memo inside of Vuex - not the cleanest solution, though. Alternatively, I wonder if we can rewrite parts of Vuex to use Proxy which gives better change detection. The code base is quite small (Vuex) so it might not be too difficult - just throwing some ideas out there.

@yyx990803
Copy link
Member

yyx990803 commented Oct 14, 2022

closed via #1883 - will release patch minor soon (note the new minor will require Vue 3.2+).

@rendomnet
Copy link

This still is ISSUE RIGHT?

@feliperaul
Copy link

Hi everyone,

The docs (https://vuex.vuejs.org/guide/getters.html#property-style-access) still contain this warning:

image

Since this PR is closed, I think this is safe to remove now?

@cuebit
Copy link
Member

cuebit commented Mar 6, 2023

Hi everyone,

The docs (https://vuex.vuejs.org/guide/getters.html#property-style-access) still contain this warning:

image

Since this PR is closed, I think this is safe to remove now?

Sure. PR welcome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants