Nuxt · Data fetching

NUXT0018Do not register mutating requests as async data

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

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 no mutation methods pattern instead.

Example

Keep mutations out of useFetch

Before

const { data } = await useFetch('/api/orders', {
  method: 'POST',
  body: { status: 'draft' },
})

After

async function createOrder() {
  return await $fetch('/api/orders', {
    method: 'POST',
    body: { status: 'draft' },
  })
}

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-no-mutation-methods
Copyright © 2026