Skip to content

fix: select defaultValue re-render issue#8816

Merged
ovflowd merged 1 commit intonodejs:mainfrom
canerakdas:fix/select-state-change
Apr 14, 2026
Merged

fix: select defaultValue re-render issue#8816
ovflowd merged 1 commit intonodejs:mainfrom
canerakdas:fix/select-state-change

Conversation

@canerakdas
Copy link
Copy Markdown
Member

Description

In our current Select component, even if the defaultValue changes, it wasn't being reflected in the UI because the effect we were using had been removed in #8672. With this PR, we're adding that effect back

Validation

OS default value would work on preview

Related Issues

Fixes: #8815

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@canerakdas canerakdas requested a review from a team as a code owner April 14, 2026 13:27
Copilot AI review requested due to automatic review settings April 14, 2026 13:27
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Apr 14, 2026 1:28pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Low Risk
Low risk UI behavior change limited to Select; it only re-syncs internal state to updated defaultValue, with minimal chance of regressions beyond components relying on the previous stale behavior.

Overview
Fixes Select not updating when its defaultValue prop changes by reintroducing a useEffect that syncs the internal value state to the latest defaultValue.

This ensures consumers (e.g., tab/select wrappers) see the selected item update on re-render when the upstream default changes, instead of staying stuck on the initial render value.

Reviewed by Cursor Bugbot for commit f15ebcd. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.26%. Comparing base (69cc705) to head (f15ebcd).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/ui-components/src/Common/Select/index.tsx 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8816      +/-   ##
==========================================
- Coverage   74.27%   74.26%   -0.01%     
==========================================
  Files         104      104              
  Lines        8847     8849       +2     
  Branches      328      328              
==========================================
+ Hits         6571     6572       +1     
- Misses       2274     2275       +1     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores Select’s ability to reflect changes to defaultValue after initial render (fixing cases like OS detection updating from LOADING to a concrete value).

Changes:

  • Import useEffect in the Select component.
  • Sync internal value state whenever defaultValue changes via a useEffect.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@araujogui araujogui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@araujogui
Copy link
Copy Markdown
Member

LGTM

I think we should avoid long PRs like #8672 in the future, cause they're hard to review and easy to let simply things like this pass

@araujogui
Copy link
Copy Markdown
Member

@nodejs/nodejs-website asking fast-track

Copy link
Copy Markdown
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM! Does this fix all the issues we saw on the deployment?

@canerakdas
Copy link
Copy Markdown
Member Author

SGTM! Does this fix all the issues we saw on the deployment?

It resolved the issues I was experiencing 👀 (Unknown value, Automatic selection)

@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 14, 2026

SGTM! Does this fix all the issues we saw on the deployment?

It resolved the issues I was experiencing 👀 (Unknown value, Automatic selection)

I wonder if other pages are also broken :/ -- any other page you've noticed anything odd that was affected by the other PR (aka thar you've seen in the diff)

@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 14, 2026

@canerakdas ☝️

@canerakdas
Copy link
Copy Markdown
Member Author

SGTM! Does this fix all the issues we saw on the deployment?

It resolved the issues I was experiencing 👀 (Unknown value, Automatic selection)

I wonder if other pages are also broken :/ -- any other page you've noticed anything odd that was affected by the other PR (aka thar you've seen in the diff)

Based on my experience, I haven't encountered any other issues

@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 14, 2026

@nodejs/nodejs-website I'm fast-tracking this as a PRODUCTION hot-fix.

@ovflowd ovflowd added this pull request to the merge queue Apr 14, 2026
Merged via the queue into nodejs:main with commit 6096558 Apr 14, 2026
19 checks 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.

Download page does not detect OS (Unknown)

5 participants