nuxt / nuxt/ui

UButton disabled driven by state causes hydration attribute mismatch on F5/Ctrl+r reload on Firefox

Open
#6,308 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
6.9k
Forks
1.1k
Avg merge
1d 7h
Merged PRs (30d)
57

Description

Environment

Operating system: Ubuntu 25.10
Node.js version v24.13.0
nuxt/cli version 3.34.0
Package manager pnpm 10.28.1
Nuxt version 4.4.2
Nitro version 2.13.3
Builder vite 7.3.1
Config $development, compatibilityDate, css, devtools, icon, modules, routeRules, runtimeConfig, vite
Modules @nuxt/ui 4.6.0
Browser: Firefox 150.0b4 (64-bit)

Is this bug related to Nuxt or Vue?

Nuxt

Package

v4.x

Version

4.6.0

Reproduction

The following code demonstrates the problem. It wasn't possible to show this on the sandbox because it doesn't support useState. To see the issue:

  1. Run the page below using nuxt development server
  2. load the page on a Firefox browser
  3. Click on the second button labelled "control button 1". The first button should then enable.
  4. Press F5. The page will reload with a hydration warning.
<script setup lang="ts">
	const teststate = useState('teststate', ()=> true);
	function click() {
		console.log("click");
	}
</script>
<template>
	<UButton
		label="button 1"
		:disabled="teststate"
		@click="click"
	/>&nbsp;
	<UButton
		label="control button 1"
		@click="teststate = !teststate"
	/>
</template>
Description

Using data related to a result from useState to control UButton disabed state causes hydration problems on reloading via F5 or Ctrl+r on Firefox.

If the state is changed so that the UButton disabled condition has changed from first load, and then the page is reloaded via F5 or ctrl+r, then a hydration mismatch is reported and the button is displayed incorrectly.

Additional context

Seems to be specific to Firefox. Chrome doesn't display the same issue.

Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Nuxt reproduction with useState and two UButton components in Firefox, then reproduce the F5 or Ctrl+r reload after changing the state. Trace the UButton disabled rendering and hydration warning; done means the button retains the correct disabled state without a hydration mismatch, including on Firefox.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.