Skip to content

Commit

Permalink
refactor(nuxt): remove duplicated check (#26544)
Browse files Browse the repository at this point in the history
  • Loading branch information
xjccc committed Mar 29, 2024
1 parent 22dfac7 commit 9b24363
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/nuxt/src/app/composables/asyncData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,11 @@ export function useAsyncData<
if (instance && !instance._nuxtOnBeforeMountCbs) {
instance._nuxtOnBeforeMountCbs = []
const cbs = instance._nuxtOnBeforeMountCbs
if (instance) {
onBeforeMount(() => {
cbs.forEach((cb) => { cb() })
cbs.splice(0, cbs.length)
})
onUnmounted(() => cbs.splice(0, cbs.length))
}
onBeforeMount(() => {
cbs.forEach((cb) => { cb() })
cbs.splice(0, cbs.length)
})
onUnmounted(() => cbs.splice(0, cbs.length))
}

if (fetchOnServer && nuxtApp.isHydrating && (asyncData.error.value || hasCachedData())) {
Expand Down

0 comments on commit 9b24363

Please sign in to comment.