mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): warn when async data doesn't return a value (#27599)
This commit is contained in:
parent
d6e723885d
commit
6a19aa79f7
@ -311,6 +311,11 @@ export function useAsyncData<
|
|||||||
result = pick(result as any, options.pick) as DataT
|
result = pick(result as any, options.pick) as DataT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (import.meta.dev && import.meta.server && !result) {
|
||||||
|
// @ts-expect-error private property
|
||||||
|
console.warn(`[nuxt] \`${options._functionName || 'useAsyncData'}\` should return a value that is not \`null\` or \`undefined\` or the request may be duplicated on the client side.`)
|
||||||
|
}
|
||||||
|
|
||||||
nuxtApp.payload.data[key] = result
|
nuxtApp.payload.data[key] = result
|
||||||
|
|
||||||
asyncData.data.value = result
|
asyncData.data.value = result
|
||||||
|
Loading…
Reference in New Issue
Block a user