From ac54da242f47c466372017be0573777857d374a6 Mon Sep 17 00:00:00 2001 From: Alex Liu Date: Mon, 11 Mar 2024 04:07:00 +0800 Subject: [PATCH] perf(nuxt): use faster approach to check cache exists (#26172) --- packages/nuxt/src/app/composables/asyncData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/asyncData.ts b/packages/nuxt/src/app/composables/asyncData.ts index 7028b3fadb..b2d5c2d3a3 100644 --- a/packages/nuxt/src/app/composables/asyncData.ts +++ b/packages/nuxt/src/app/composables/asyncData.ts @@ -243,7 +243,7 @@ export function useAsyncData< console.warn('[nuxt] `boolean` values are deprecated for the `dedupe` option of `useAsyncData` and will be removed in the future. Use \'cancel\' or \'defer\' instead.') } - const hasCachedData = () => ![null, undefined].includes(options.getCachedData!(key) as any) + const hasCachedData = () => options.getCachedData!(key) != null // Create or use a shared asyncData entity if (!nuxtApp._asyncData[key] || !options.immediate) {