fix(nuxt): stop loading indicator on vue errors (#20738)

This commit is contained in:
Alexander 2023-05-15 21:34:20 +06:00 committed by GitHub
parent 26c6531282
commit e9b2f6286c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -11,9 +11,10 @@ export default defineComponent({
const error = ref<Error | null>(null) const error = ref<Error | null>(null)
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
onErrorCaptured((err) => { onErrorCaptured((err, target, info) => {
if (process.client && !nuxtApp.isHydrating) { if (process.client && !nuxtApp.isHydrating) {
emit('error', err) emit('error', err)
nuxtApp.hooks.callHook('vue:error', err, target, info)
error.value = err error.value = err
return false return false
} }

View File

@ -32,6 +32,7 @@ export default defineComponent({
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
nuxtApp.hook('page:start', indicator.start) nuxtApp.hook('page:start', indicator.start)
nuxtApp.hook('page:finish', indicator.finish) nuxtApp.hook('page:finish', indicator.finish)
nuxtApp.hook('vue:error', indicator.finish)
onBeforeUnmount(indicator.clear) onBeforeUnmount(indicator.clear)
return () => h('div', { return () => h('div', {