File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,8 @@ export default {
240
240
241
241
// Server-side only
242
242
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.
243
245
this .registerFoo ()
244
246
return this .fooInc ()
245
247
},
@@ -251,7 +253,7 @@ export default {
251
253
const alreadyIncremented = !! this .$store .state .foo
252
254
253
255
// We register the foo module
254
- this .registerFoo ()
256
+ this .registerFoo (true )
255
257
256
258
if (! alreadyIncremented) {
257
259
this .fooInc ()
@@ -265,9 +267,9 @@ export default {
265
267
},
266
268
267
269
methods: {
268
- registerFoo () {
270
+ registerFoo (shoudPreserve = false ) {
269
271
// 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 })
271
273
},
272
274
273
275
fooInc () {
You can’t perform that action at this time.
0 commit comments