mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): unsub from hooks when unmounting indicator (#22592)
This commit is contained in:
parent
8b61c29f93
commit
1a61cb22ec
@ -54,14 +54,16 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
nuxtApp.hook('page:finish', indicator.finish)
|
const unsubPage = nuxtApp.hook('page:finish', indicator.finish)
|
||||||
nuxtApp.hook('vue:error', indicator.finish)
|
const unsubError = nuxtApp.hook('vue:error', indicator.finish)
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
const index = globalMiddleware.indexOf(indicator.start)
|
const index = globalMiddleware.indexOf(indicator.start)
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
globalMiddleware.splice(index, 1)
|
globalMiddleware.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
unsubPage()
|
||||||
|
unsubError()
|
||||||
indicator.clear()
|
indicator.clear()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user