Nuxt · NUXT0031

Avoid client-only conditionals in SSR templates

Flags client conditional in template in Nuxt hydration code before it leaks into runtime behavior.
NUXT0031vite-doctor/nuxthydrationwarnSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/hydration/no-client-conditional-in-template

Why it matters

Server-rendered markup must match the first client render. Browser-only state, time, randomness, or hash-sensitive URLs can create hydration mismatches.

Remove client conditional in template, or move it to the Nuxt runtime/API that owns that behavior.

Example

Use ClientOnly for client conditions

Before

<template>
  <p v-if="import.meta.client">Client only</p>
</template>

After

<template>
  <ClientOnly>
    <p>Client only</p>
  </ClientOnly>
</template>
Copyright © 2026