Skip to content

Conversation

@gstcarv
Copy link

@gstcarv gstcarv commented Dec 31, 2025

Summary

This PR fixes a flickering issue when using react-select with server-side rendering (Next.js, TanStack Start).
The root cause was that prerendering was not working correctly in these environments, causing the selected value to appear only after the JavaScript loaded, which led to CLS issues.

Before Now
Gravacao.de.Tela.2025-12-31.as.00.10.13.mov
Gravacao.de.Tela.2025-12-31.as.00.09.05.mov

Solution

To support SSR, prerendering was added to the Select components, mainly for the Select Options. Components that previously did not support SSR were replaced with div elements so that prerendering would work correctly. With prerendering in place, we now iterate through the Select component’s children tree to find the selected item and use it as the value for the correct prerendered output.

Captura de Tela 2025-12-31 às 00 08 49

Fixes #3431

@changeset-bot
Copy link

changeset-bot bot commented Dec 31, 2025

🦋 Changeset detected

Latest commit: c5e5181

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@radix-ui/react-select Patch
radix-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Flicker when Select renders with default values

1 participant