fix(nuxt): improve async data warning (#27874) (#27934)

This commit is contained in:
Seno 2024-07-01 20:34:41 +12:00 committed by GitHub
parent ed7a14aecc
commit 4ff29bb165
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -310,7 +310,7 @@ export function useAsyncData<
if (import.meta.dev && import.meta.server && !result) { if (import.meta.dev && import.meta.server && !result) {
// @ts-expect-error private property // @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.`) console.warn(`[nuxt] \`${options._functionName || 'useAsyncData'}\` must return a truthy value (for example, it should not be \`undefined\`, \`null\` or empty string) or the request may be duplicated on the client side.`)
} }
nuxtApp.payload.data[key] = result nuxtApp.payload.data[key] = result