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 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')