Nuxt · NUXT0017

Keep async data handlers replay-safe

Finds Nuxt project code that can be written with a clearer framework-supported pattern.
NUXT0017vite-doctor/nuxtfetchingwarnSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/async-data-handler-pure

Why it matters

Nuxt data fetching relies on stable keys, payload serialization, and request context. Bypassing those contracts can duplicate requests or lose SSR data.

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')
})
Copyright © 2026