Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed null value of search input - @AdKamil (#3778)
- Fixed product sorting - @AdKamil (#3785)
- Redirect from simple product using url_path - @benjick (#3804)
- Mount app in 'beforeResolve' if it's not dispatched in 'onReady' - @gibkigonzo (#3669)


## [1.11.0-rc.2] - 2019.10.31
Expand Down
18 changes: 11 additions & 7 deletions core/client-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,21 @@ const invokeClientEntry = async () => {
})
}
router.onReady(async () => {
// check if app can be mounted
const canBeMounted = () => RouterManager.isRouteDispatched() && // route is dispatched
!(router as any).history.pending && // there is no pending in router history
!(app as any)._isMounted // it's not mounted before

if (canBeMounted()) {
app.$mount('#app')
}
router.beforeResolve((to, from, next) => {
if (!from.name) {
// Mounting app
if (!RouterManager.isRouteDispatched()) {
RouterManager.addDispatchCallback(() => {
app.$mount('#app')
})
} else {
next()
if (canBeMounted()) {
app.$mount('#app')
}
return next() // do not resolve asyncData on server render - already been done
return // do not resolve asyncData on server render - already been done
}
if (Vue.prototype.$ssrRequestContext) Vue.prototype.$ssrRequestContext.output.cacheTags = new Set<string>()
const matched = router.getMatchedComponents(to)
Expand Down