From e8ce3f5583517b21a4978308fa5b91841e5fcbab Mon Sep 17 00:00:00 2001 From: tkostuch Date: Tue, 18 Feb 2020 12:22:38 +0100 Subject: [PATCH 1/2] Disable overriding route state in __INITIAL_STATE__ --- core/client-entry.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/client-entry.ts b/core/client-entry.ts index e02f4b207c..71e8bd3793 100755 --- a/core/client-entry.ts +++ b/core/client-entry.ts @@ -13,6 +13,7 @@ import { AsyncDataLoader } from './lib/async-data-loader' import { Logger } from '@vue-storefront/core/lib/logger' import globalConfig from 'config' import { RouterManager } from './lib/router-manager'; +import omit from 'lodash-es/omit' declare var window: any const invokeClientEntry = async () => { @@ -22,7 +23,8 @@ const invokeClientEntry = async () => { const { app, router, store } = await createApp(null, dynamicRuntimeConfig, storeCode) if (window.__INITIAL_STATE__) { - store.replaceState(Object.assign({}, store.state, window.__INITIAL_STATE__, { config: globalConfig })) + const initialState = omit(window.__INITIAL_STATE__, ['storeView', 'config', 'version', 'route']) + store.replaceState(Object.assign({}, store.state, initialState, { config: globalConfig })) } await store.dispatch('url/registerDynamicRoutes') From d2c1965463c6b2d16ccbf38bbb91f6a2bc9aa22f Mon Sep 17 00:00:00 2001 From: tkostuch Date: Tue, 18 Feb 2020 13:23:12 +0100 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8e647dfec..78f4925132 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix v-model not working in BaseRadioButton - @lukeromanowicz (#4035) - add disconnect and sync options for clear/cart - @gibkigonzo (#4062) - Fix current token invalidation with refresh token - @gibkigonzo (#3928, #3620, #3626) +- Disable overriding `route`, `config`, `storeView`, `version` state in __INITIAL_STATE__ - @gibkigonzo (pr#4095) ## [1.10.5] - 28.11.2019