mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix: SSR call router.push after plugin execution
This commit is contained in:
parent
c9e77337b3
commit
12a31b0914
@ -45,12 +45,6 @@ async function createApp (ssrContext) {
|
||||
|
||||
<% if (store) { %>const store = createStore()<% } %>
|
||||
|
||||
if (process.server && ssrContext && ssrContext.url) {
|
||||
await new Promise((resolve, reject) => {
|
||||
router.push(ssrContext.url, resolve, reject)
|
||||
})
|
||||
}
|
||||
|
||||
// Create Root instance
|
||||
// here we inject the router and store to all child components,
|
||||
// making them available everywhere as `this.$router` and `this.$store`.
|
||||
@ -94,8 +88,10 @@ async function createApp (ssrContext) {
|
||||
}
|
||||
|
||||
const next = ssrContext ? ssrContext.next : location => app.router.push(location)
|
||||
let route = router.currentRoute
|
||||
if (!ssrContext) {
|
||||
let route
|
||||
if (ssrContext) {
|
||||
route = router.resolve(ssrContext.url).route
|
||||
} else {
|
||||
const path = getLocation(router.options.base)
|
||||
route = router.resolve(path).route
|
||||
}
|
||||
@ -127,6 +123,12 @@ async function createApp (ssrContext) {
|
||||
}
|
||||
<% } %>
|
||||
|
||||
if (process.server && ssrContext && ssrContext.url) {
|
||||
await new Promise((resolve, reject) => {
|
||||
router.push(ssrContext.url, resolve, reject)
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
app,
|
||||
router,
|
||||
|
Loading…
Reference in New Issue
Block a user