Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 0390ad6

Browse files
authored
Merge pull request #4095 from gibkigonzo/bugfix/disable-overriding-route-store
Disable overriding route state in __INITIAL_STATE__
2 parents 6eae418 + d2c1965 commit 0390ad6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Fix v-model not working in BaseRadioButton - @lukeromanowicz (#4035)
1919
- add disconnect and sync options for clear/cart - @gibkigonzo (#4062)
2020
- Fix current token invalidation with refresh token - @gibkigonzo (#3928, #3620, #3626)
21+
- Disable overriding `route`, `config`, `storeView`, `version` state in __INITIAL_STATE__ - @gibkigonzo (pr#4095)
2122

2223
## [1.10.5] - 28.11.2019
2324

core/client-entry.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { AsyncDataLoader } from './lib/async-data-loader'
1313
import { Logger } from '@vue-storefront/core/lib/logger'
1414
import globalConfig from 'config'
1515
import { RouterManager } from './lib/router-manager';
16+
import omit from 'lodash-es/omit'
1617
declare var window: any
1718

1819
const invokeClientEntry = async () => {
@@ -22,7 +23,8 @@ const invokeClientEntry = async () => {
2223
const { app, router, store } = await createApp(null, dynamicRuntimeConfig, storeCode)
2324

2425
if (window.__INITIAL_STATE__) {
25-
store.replaceState(Object.assign({}, store.state, window.__INITIAL_STATE__, { config: globalConfig }))
26+
const initialState = omit(window.__INITIAL_STATE__, ['storeView', 'config', 'version', 'route'])
27+
store.replaceState(Object.assign({}, store.state, initialState, { config: globalConfig }))
2628
}
2729

2830
await store.dispatch('url/registerDynamicRoutes')

0 commit comments

Comments
 (0)