-
-
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
feat: preserve state with registerModule #837
Conversation
b49a778
to
6950bda
Compare
6950bda
to
092118a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This would fix #789 |
Awesome, had this in my mind for months just forgot about it. |
does this mean you could pass the import directly also?
or similar to Vue.use that it is a fn that returns the
|
Not yet! This is my next thing to do. Small things at a time haha! |
😎 np cheers on this addition for SSR |
🤘 |
@TheLarkInn I'm going to go with the latter, as it will require less code in Vuex and a simple integration. Also doesn't require the need to do custom waiting mechanisms for promise to resolve. |
So like this?
|
yes but it is |
/ping @vuejs/collaborators |
As speaking with @TheLarkInn we where saying it would be awesome to be able to register a module dynamically to be able to code split the store in a large application.
It is totally possible with
store.registerModule('a', module)
. Here is an example, if using hooks to ensure prevent the route loading. This can be achieved withasyncData
with client mixins and global hooks. https://ssr.vuejs.org/en/data.htmlThe issue with this with SSR this would replace the pre-populated data. This pull request aims to fix this scenario.