mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +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>
|
||||
<Suspense @resolve="onResolve">
|
||||
<div v-if="abortRender" />
|
||||
<ErrorComponent
|
||||
v-if="error"
|
||||
v-else-if="error"
|
||||
:error="error"
|
||||
/>
|
||||
<IslandRenderer
|
||||
@ -53,6 +54,8 @@ if (import.meta.dev && results && results.some(i => i && 'then' in i)) {
|
||||
|
||||
// error handling
|
||||
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) => {
|
||||
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))) {
|
||||
|
Loading…
Reference in New Issue
Block a user