fix(nuxt): throw hard error on initial spa load if aborted (#6857)

This commit is contained in:
Daniel Roe 2022-08-23 09:42:54 +01:00 committed by GitHub
parent 347df12e9a
commit aab90efc19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,7 +143,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
}
const result = await callWithNuxt(nuxtApp, middleware, [to, from])
if (process.server) {
if (process.server || (!nuxtApp.payload.serverRendered && nuxtApp.isHydrating)) {
if (result === false || result instanceof Error) {
const error = result || createError({
statusMessage: `Route navigation aborted: ${initialURL}`