mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
fix(nuxt): revert change to getCachedData
null response
This commit is contained in:
parent
e21f68140c
commit
d10cea11be
@ -253,16 +253,16 @@ export function useAsyncData<
|
||||
}
|
||||
|
||||
// TODO: make more precise when v4 lands
|
||||
const hasCachedData = () => options.getCachedData!(key, nuxtApp) !== undefined
|
||||
const hasCachedData = () => options.getCachedData!(key, nuxtApp) != null
|
||||
|
||||
// Create or use a shared asyncData entity
|
||||
if (!nuxtApp._asyncData[key] || !options.immediate) {
|
||||
nuxtApp.payload._errors[key] ??= asyncDataDefaults.errorValue
|
||||
|
||||
const _ref = options.deep ? ref : shallowRef
|
||||
const cachedData = options.getCachedData!(key, nuxtApp)
|
||||
|
||||
nuxtApp._asyncData[key] = {
|
||||
data: _ref(typeof cachedData !== 'undefined' ? cachedData : options.default!()),
|
||||
data: _ref(options.getCachedData!(key, nuxtApp) ?? options.default!()),
|
||||
pending: ref(!hasCachedData()),
|
||||
error: toRef(nuxtApp.payload._errors, key),
|
||||
status: ref('idle'),
|
||||
|
Loading…
Reference in New Issue
Block a user