Skip to content

Hydration mismatch with useId() if <Icon /> is used on parent component #310

@Perdolique

Description

@Perdolique

Problem

I'm using useId() provided by Vue to connect input and label together (CustomInput component). But having <Icon /> somewhere on the page makes a hydration mismatch on CustomInput.

Warning example
[Vue warn]: Hydration attribute mismatch on <label for=​"v-1-0">​Woof​</label>​ 
  - rendered on server: for="v-1-0"
  - expected on client: for="v-0-0"
  at <CustomInput label="Woof" > 
  at <TestComponent> 
  at <App key=4 > 
  at <NuxtRoot>

Every new icon increases the id generated on the server to 1.

Reproduction

Stackblitz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions