Skip to content

Commit c1b83ea

Browse files
committed
fix(nuxt): update warning message to warn against null values
resolves #28920
1 parent 993f3b9 commit c1b83ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/nuxt/src/app/composables/asyncData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,12 +676,12 @@ function createAsyncData<
676676
result = pick(result as any, options.pick) as DataT
677677
}
678678

679-
if (import.meta.dev && import.meta.server && typeof result === 'undefined') {
679+
if (import.meta.dev && import.meta.server && result == null) {
680680
const stack = captureStackTrace()
681681
const { source, line, column } = stack[stack.length - 1] ?? {}
682682
const explanation = source ? ` (used at ${source.replace(/^file:\/\//, '')}:${line}:${column})` : ''
683683
// @ts-expect-error private property
684-
console.warn(`[nuxt] \`${options._functionName || 'useAsyncData'}${explanation}\` must return a value (it should not be \`undefined\`) or the request may be duplicated on the client side.`)
684+
console.warn(`[nuxt] \`${options._functionName || 'useAsyncData'}${explanation}\` must return a value (it should not be \`undefined\` or \`null\`) or the request may be duplicated on the client side.`)
685685
}
686686

687687
nuxtApp.payload.data[key] = result

0 commit comments

Comments
 (0)