Skip to content

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Nov 19, 2025

defaultValue is used for uncontrolled components - those that do not have an onChange handler. You usually either pass defaultValue (fully uncontrolled), or you pass value + onChange (fully controlled)

uncontrolled only makes sense in forms where you take the “html” value from the form submit handler, which is not something we do right now. All usages except one in production are controlled usages.

The one usage in gsApp/views/subscriptionPage/usageLog.tsx passes a defaultValue decoded from the url and has an onChange handler that navigates. This will work just the same when passing value. Actually using nuqs would make this explicit.

Note: This is a preparation for a larger refactoring / perf improvement of compactSelect to avoid rendering all options eagerly.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 19, 2025
@TkDodo TkDodo marked this pull request as ready for review November 19, 2025 13:43
@TkDodo TkDodo requested review from a team as code owners November 19, 2025 13:43
@TkDodo TkDodo requested a review from gggritso November 19, 2025 13:43
@TkDodo TkDodo merged commit 4bc8063 into master Nov 19, 2025
49 checks passed
@TkDodo TkDodo deleted the tkdodo/ref/make-compactSelect-always-controlled branch November 19, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants