diff --git a/packages/nuxt/src/app/composables/asyncData.ts b/packages/nuxt/src/app/composables/asyncData.ts index 2081b96307..dc1c24eb77 100644 --- a/packages/nuxt/src/app/composables/asyncData.ts +++ b/packages/nuxt/src/app/composables/asyncData.ts @@ -106,10 +106,6 @@ export interface AsyncDataExecuteOptions { export interface _AsyncData { data: Ref - /** - * @deprecated Use `status` instead. This may be removed in a future major version. - */ - pending: Ref refresh: (opts?: AsyncDataExecuteOptions) => Promise execute: (opts?: AsyncDataExecuteOptions) => Promise clear: () => void @@ -249,7 +245,6 @@ export function useAsyncData< const _ref = options.deep ? ref : shallowRef nuxtApp._asyncData[key] = { data: _ref(hasCachedData ? initialCachedData : options.default!()), - pending: ref(!hasCachedData), error: toRef(nuxtApp.payload._errors, key), status: ref('idle'), _default: options.default!, @@ -277,7 +272,6 @@ export function useAsyncData< return Promise.resolve(cachedData) } } - asyncData.pending.value = true asyncData.status.value = 'pending' // TODO: Cancel previous promise const promise = new Promise( @@ -322,8 +316,6 @@ export function useAsyncData< .finally(() => { if ((promise as any).cancelled) { return } - asyncData.pending.value = false - delete nuxtApp._asyncDataPromises[key] }) nuxtApp._asyncDataPromises[key] = promise @@ -366,7 +358,6 @@ export function useAsyncData< if (fetchOnServer && nuxtApp.isHydrating && (asyncData.error.value || typeof initialCachedData !== 'undefined')) { // 1. Hydration (server: true): no fetch - asyncData.pending.value = false asyncData.status.value = asyncData.error.value ? 'error' : 'success' } else if (instance && ((nuxtApp.payload.serverRendered && nuxtApp.isHydrating) || options.lazy) && options.immediate) { // 2. Initial load (server: false): fetch on mounted @@ -527,7 +518,6 @@ function clearNuxtDataByKey (nuxtApp: NuxtApp, key: string): void { if (nuxtApp._asyncData[key]) { nuxtApp._asyncData[key]!.data.value = nuxtApp._asyncData[key]!._default() nuxtApp._asyncData[key]!.error.value = undefined - nuxtApp._asyncData[key]!.pending.value = false nuxtApp._asyncData[key]!.status.value = 'idle' } diff --git a/packages/nuxt/src/app/nuxt.ts b/packages/nuxt/src/app/nuxt.ts index 4faff0a1bc..78dfbf99d7 100644 --- a/packages/nuxt/src/app/nuxt.ts +++ b/packages/nuxt/src/app/nuxt.ts @@ -126,10 +126,6 @@ interface _NuxtApp { /** @internal */ _asyncData: Record - /** - * @deprecated This may be removed in a future major version. - */ - pending: Ref error: Ref status: Ref /** @internal */ diff --git a/test/fixtures/basic/pages/useAsyncData/nuxt-data.vue b/test/fixtures/basic/pages/useAsyncData/nuxt-data.vue index f661a6b5d9..8724461cdf 100644 --- a/test/fixtures/basic/pages/useAsyncData/nuxt-data.vue +++ b/test/fixtures/basic/pages/useAsyncData/nuxt-data.vue @@ -1,6 +1,6 @@