mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 00:52:01 +00:00
fix(nuxt): await for router.push
on ssr (#4491)
This commit is contained in:
parent
650d12fa9c
commit
46ecbc558d
@ -167,8 +167,6 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (process.server) {
|
if (process.server) {
|
||||||
router.push(nuxtApp.ssrContext.url)
|
|
||||||
|
|
||||||
router.afterEach(async (to) => {
|
router.afterEach(async (to) => {
|
||||||
if (to.fullPath !== nuxtApp.ssrContext.url) {
|
if (to.fullPath !== nuxtApp.ssrContext.url) {
|
||||||
await navigateTo(to.fullPath)
|
await navigateTo(to.fullPath)
|
||||||
@ -177,6 +175,10 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (process.server) {
|
||||||
|
await router.push(nuxtApp.ssrContext.url)
|
||||||
|
}
|
||||||
|
|
||||||
await router.isReady()
|
await router.isReady()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
callWithNuxt(nuxtApp, throwError, [error])
|
callWithNuxt(nuxtApp, throwError, [error])
|
||||||
|
Loading…
Reference in New Issue
Block a user