mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): do not accept attrs on <NuxtErrorBoundary>
(#28901)
This commit is contained in:
parent
93b5b04e9a
commit
213ce66c36
@ -2,6 +2,8 @@ import { defineComponent, onErrorCaptured, ref } from 'vue'
|
|||||||
import { useNuxtApp } from '../nuxt'
|
import { useNuxtApp } from '../nuxt'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
name: 'NuxtErrorBoundary',
|
||||||
|
inheritAttrs: false,
|
||||||
emits: {
|
emits: {
|
||||||
error (_error: unknown) {
|
error (_error: unknown) {
|
||||||
return true
|
return true
|
||||||
@ -11,14 +13,16 @@ export default defineComponent({
|
|||||||
const error = ref<Error | null>(null)
|
const error = ref<Error | null>(null)
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
|
||||||
onErrorCaptured((err, target, info) => {
|
if (import.meta.client) {
|
||||||
if (import.meta.client && (!nuxtApp.isHydrating || !nuxtApp.payload.serverRendered)) {
|
onErrorCaptured((err, target, info) => {
|
||||||
emit('error', err)
|
if (!nuxtApp.isHydrating || !nuxtApp.payload.serverRendered) {
|
||||||
nuxtApp.hooks.callHook('vue:error', err, target, info)
|
emit('error', err)
|
||||||
error.value = err
|
nuxtApp.hooks.callHook('vue:error', err, target, info)
|
||||||
return false
|
error.value = err
|
||||||
}
|
return false
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function clearError () {
|
function clearError () {
|
||||||
error.value = null
|
error.value = null
|
||||||
|
Loading…
Reference in New Issue
Block a user