fix(nuxt): allow getCachedData to return undefined (#28187)

This commit is contained in:
Julien Huang 2024-07-16 23:40:51 +02:00 committed by Daniel Roe
parent 6abaae7fa1
commit a6af09eba4
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -63,10 +63,10 @@ export interface AsyncDataOptions<
default?: () => DefaultT | Ref<DefaultT>
/**
* Provide a function which returns cached data.
* A `null` or `undefined` return value will trigger a fetch.
* An `undefined` return value will trigger a fetch.
* Default is `key => nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key]` which only caches data when payloadExtraction is enabled.
*/
getCachedData?: (key: string, nuxtApp: NuxtApp) => NoInfer<DataT>
getCachedData?: (key: string, nuxtApp: NuxtApp) => NoInfer<DataT> | undefined
/**
* A function that can be used to alter handler function result after resolving.
* Do not use it along with the `pick` option.