Vue · SSR safety

VUE0013Use useId for SSR-stable ids

Finds Vue SSR code that can be written with a clearer framework-supported pattern.

Why it happens

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

Fix

Use the Vue-supported use id for stable ids pattern instead.

Example

Use stable IDs

Before

<script setup lang="ts">
const id = Math.random().toString(36)
</script>

After

<script setup lang="ts">
const id = useId()
</script>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --framework vue --rules vue/ssr/use-id-for-stable-ids
Copyright © 2026