Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): select should respond to value changes #1150

Merged
merged 2 commits into from
Nov 26, 2021
Merged

Conversation

rabelloo
Copy link
Contributor

Purpose

React's <Select /> does not update when its value changes, but it should.

Approach

Introduce useEffect hooks that set internal value when it changes.
Also change initialize a bit so that the correct option JSX can be found with its value as key.

Testing

Storybook with value property defined and changed with, for example, hooks and buttons

Risks

Slightly increases Select's bundle size

@rabelloo rabelloo added the bug Something isn't working label Nov 24, 2021
@rabelloo rabelloo requested a review from josokinas November 24, 2021 16:10
@rabelloo rabelloo self-assigned this Nov 24, 2021
@vercel
Copy link

vercel bot commented Nov 24, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/onfido-oss/castor/4C7STpZa7G8BfoEph33wmrNE9bfB
✅ Preview: https://castor-git-fix-select-onfido-oss.vercel.app

Co-authored-by: Julius Osokinas <20243687+josokinas@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants