mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
perf(nuxt): abort vue render when plugins throw error (#27304)
This commit is contained in:
parent
8a759bc6fe
commit
eb0bebc46d
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<Suspense @resolve="onResolve">
|
<Suspense @resolve="onResolve">
|
||||||
|
<div v-if="abortRender" />
|
||||||
<ErrorComponent
|
<ErrorComponent
|
||||||
v-if="error"
|
v-else-if="error"
|
||||||
:error="error"
|
:error="error"
|
||||||
/>
|
/>
|
||||||
<IslandRenderer
|
<IslandRenderer
|
||||||
@ -53,6 +54,8 @@ if (import.meta.dev && results && results.some(i => i && 'then' in i)) {
|
|||||||
|
|
||||||
// error handling
|
// error handling
|
||||||
const error = useError()
|
const error = useError()
|
||||||
|
// render an empty <div> when plugins have thrown an error but we're not yet rendering the error page
|
||||||
|
const abortRender = import.meta.server && error.value && !nuxtApp.ssrContext.error
|
||||||
onErrorCaptured((err, target, info) => {
|
onErrorCaptured((err, target, info) => {
|
||||||
nuxtApp.hooks.callHook('vue:error', err, target, info).catch(hookError => console.error('[nuxt] Error in `vue:error` hook', hookError))
|
nuxtApp.hooks.callHook('vue:error', err, target, info).catch(hookError => console.error('[nuxt] Error in `vue:error` hook', hookError))
|
||||||
if (import.meta.server || (isNuxtError(err) && (err.fatal || err.unhandled))) {
|
if (import.meta.server || (isNuxtError(err) && (err.fatal || err.unhandled))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user