Skip to content

fix: animated-number restarts from the shown value; theme hydrates cleanly - #81

Merged
TheGreatAxios merged 1 commit into
cl-9431-react-ui-functional-updatesfrom
cl-9432-react-ui-animated-number-theme-hydration
Sep 27, 2026
Merged

TheGreatAxios merged 1 commit into
cl-9431-react-ui-functional-updatesfrom
cl-9432-react-ui-animated-number-theme-hydration

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Closes CL-9432

AnimatedNumber. fromRef was only updated when a count finished, so a new value arriving mid-count jumped back to the previous target before animating. Each frame now writes the interpolated number to fromRef, so the next count starts from what is on screen.

ThemeProvider. The initial state read localStorage and matchMedia during render, so a client with a stored preference or a dark OS rendered different text than the server and hydration failed. Preference now starts from the defaultMode/defaultPreset fallback and system dark starts false, matching the server; the existing mount effects read storage and matchMedia afterwards. The unused readSystemPrefersDark helper is removed.

Tests: a value change mid-count continues from the displayed number (fake requestAnimationFrame/performance.now); renderToString then hydrateRoot with a stored dark preference reports no recoverable errors and ends on dark/dark. Both fail on the previous code. No public API change.

@TheGreatAxios
TheGreatAxios added this pull request to stack #74 September 27, 2026 00:33
@TheGreatAxios
TheGreatAxios merged commit 67795c4 into main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant