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: Properly use initial option for SelectField for lazy loaded options #858

Merged
merged 7 commits into from
Apr 26, 2023

Conversation

allangaldinosilva
Copy link
Contributor

This PR fixes a problem when a SelectField have a initial value (as object) and that selected option are not on the options list (because it's not loaded yet).

Issue video demo

Screen.Recording.2023-04-25.at.11.17.02.mov

After changes (working)

Screen.Recording.2023-04-25.at.20.15.54.mov

@allangaldinosilva allangaldinosilva changed the title fix: Properly use initial option for SelectField when lazy load options fix: Properly use initial option for SelectField for lazy loaded options Apr 25, 2023
Copy link
Contributor

@bdow bdow left a comment

Choose a reason for hiding this comment

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

Thanks for updating this! I appreciate the storybook example, though what do you think about adding a regression test for this behavior? I'd be happy to help write a test out for it if you'd like it. I think a test would be very helpful, as you can't verify it is working without manually testing the story right now.

src/inputs/internal/ComboBoxBase.tsx Outdated Show resolved Hide resolved
src/inputs/internal/ComboBoxBase.tsx Outdated Show resolved Hide resolved
src/inputs/internal/ComboBoxBase.tsx Outdated Show resolved Hide resolved
src/inputs/internal/ComboBoxBase.tsx Outdated Show resolved Hide resolved
src/inputs/SelectField.stories.tsx Outdated Show resolved Hide resolved
@allangaldinosilva
Copy link
Contributor Author

allangaldinosilva commented Apr 26, 2023

Thanks for updating this! I appreciate the storybook example, though what do you think about adding a regression test for this behavior? I'd be happy to help write a test out for it if you'd like it. I think a test would be very helpful, as you can't verify it is working without manually testing the story right now.

That's good @bdow, I've just pushed one test on last commit, feel free to review it and improve if think is needed.

@allangaldinosilva allangaldinosilva merged commit b3dc93d into main Apr 26, 2023
@allangaldinosilva allangaldinosilva deleted the fix/fix-select-load-async-options branch April 26, 2023 14:00
homebound-team-bot pushed a commit that referenced this pull request Apr 26, 2023
## [2.272.2](v2.272.1...v2.272.2) (2023-04-26)

### Bug Fixes

* Properly use initial option for SelectField for lazy loaded options ([#858](#858)) ([b3dc93d](b3dc93d))
@homebound-team-bot
Copy link

🎉 This PR is included in version 2.272.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants