File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff 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 () {
You can’t perform that action at this time.
0 commit comments