vuejs/vue2-ssr-docs

Vuex state data is not equal to SSR's data

akagamina opened this issue · 1 comments

I am using SSR on my project with express.js.

When i request with serverPrefetch on server, response return success, and page is load. but at first, data is not correct showing other or old data.

correct data is updated when the component mounts, but the server-side component not matched to correct data

like this. IMAGE

methods:{ getCompanyProf () { registerStoreModule({ module: companyProfileModule, moduleName: 'companyProfile', store: this.$store }) let paramsArr = this.$route.params.id.split('-') let params = { companyProfileParams: { profileId: paramsArr[paramsArr.length - 1], companyId: paramsArr[paramsArr.length - 2], clientType: 'web', hash: this.$route.query.hash ? this.$route.query.hash : null, isShadow: this.$route.query.isShadow ? 1 : 0 }, companyProfileJobsParams: { profileId: paramsArr[paramsArr.length - 1], companyId: paramsArr[paramsArr.length - 2], pageNumber: 1, pageSize: 9 } } this.$store.dispatch(GET_COMPANY_PROFILE, params.companyProfileParams) } }
serverPrefetch () { this.getCompanyProf()},

I think there is nonsense cache but i dont why? Can you help me?

try runInNewContext: true
renderer = createBundleRenderer( serverBundle, { runInNewContext: true, template: fs.readFileSync(templatePath, 'utf-8'), clientManifest } )