Nuxt · Data fetching

NUXT0043Make preview mode refresh behavior explicit

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

Why it happens

usePreviewMode() can refresh every async-data key when preview state changes, including requests unrelated to preview content.

Fix

Use the Nuxt-supported preview mode global refresh pattern instead.

Example

Refresh preview data by key

Before

if (preview.value) {
  await refreshNuxtData()
}

After

if (preview.value) {
  await refreshNuxtData('preview-posts')
}

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/preview-mode-global-refresh
Copyright © 2026