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

Mention how to avoid stateful singletons in SSR (fix #807) #809

Merged
merged 1 commit into from
May 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ You can also remove a dynamically registered module with `store.unregisterModule

Sometimes we may need to create multiple instances of a module, for example:

- Creating multiple stores that uses the same module;
- Creating multiple stores that uses the same module (e.g. To [avoid stateful singletons in the SSR](https://ssr.vuejs.org/en/structure.html#avoid-stateful-singletons) when the `runInNewContext` option is `false` or `'once'`);
- Register the same module multiple times in the same store.

If we use a plain object to declare the state of the module, then that state object will be shared by reference and cause cross store/module state pollution when it's mutated.
Expand Down