Skip to content

Commit d354d32

Browse files
authored
incorrect module foo
1 parent eb1c9db commit d354d32

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/guide/data.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ export default {
240240
241241
// Server-side only
242242
serverPrefetch () {
243+
// register store module on server-side and dont preserve state at current step,
244+
// since module foo's state has not been initiated yet.
243245
this.registerFoo()
244246
return this.fooInc()
245247
},
@@ -251,7 +253,7 @@ export default {
251253
const alreadyIncremented = !!this.$store.state.foo
252254
253255
// We register the foo module
254-
this.registerFoo()
256+
this.registerFoo(true)
255257
256258
if (!alreadyIncremented) {
257259
this.fooInc()
@@ -265,9 +267,9 @@ export default {
265267
},
266268
267269
methods: {
268-
registerFoo () {
270+
registerFoo (shoudPreserve = false) {
269271
// Preserve the previous state if it was injected from the server
270-
this.$store.registerModule('foo', fooStoreModule, { preserveState: true })
272+
this.$store.registerModule('foo', fooStoreModule, { preserveState: shoudPreserve })
271273
},
272274
273275
fooInc () {

0 commit comments

Comments
 (0)