Nuxt · Data fetching
NUXT0017Keep async data handlers replay-safe
Finds Nuxt project code that can be written with a clearer framework-supported pattern.
vite-doctor/nuxtfetchingwarnSuggestion
Why it happens
Nuxt data fetching relies on stable keys, payload serialization, and request context. Bypassing those contracts can duplicate requests or lose SSR data.
Fix
Use the Nuxt-supported async data handler pure pattern instead.
Example
Keep async data handlers pure
Before
const { data } = await useAsyncData('orders', async () => {
await $fetch('/api/audit', { method: 'POST' })
return $fetch('/api/orders')
})
After
const { data } = await useAsyncData('orders', () => {
return $fetch('/api/orders')
})
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm nuxt doctor --rules nuxt/async-data-handler-pure