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: allow FluentCombobox to be cleared from code #1613

Merged
merged 2 commits into from
Mar 4, 2024

Conversation

joriverm
Copy link
Contributor

@joriverm joriverm commented Mar 1, 2024

Pull Request

πŸ“– Description

in #1485 it was made possible to set the selected value from code by implementing the OnParameterAsync for the FluentCombobox, however there was a small bug that prevented it from being cleared by code, and when null was set it would just revert back to the previous selection.
this fix allows it to be cleared by code when needed
Our use case was when we were clearing the form after a submit or pressing the reset button (which set the form to a new instance)

🎫 Issues

#1485

πŸ‘©β€πŸ’» Reviewer Notes

this can be tested by adding these buttons to ComboboxWithOptionTemplate.razor :

<FluentButton OnClick=@(() => {Person = null!; StateHasChanged();})>Reset</FluentButton>
<FluentButton OnClick=@(() => {Person = Data.People.Last(); StateHasChanged();})>Set</FluentButton> 

my test scenario was :

  • select person
  • select different person
  • click set button
  • select a different person
  • click reset button
  • select a different person

πŸ“‘ Test Plan

N/A afaik

if unit tests are needed to be added, i can look into this, but i couldn't find any combobox unit tests by the looks of it.
it might be better to see if they can be added imo

βœ… Checklist

General

  • I have tested my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.
  • I have added tests for my changes.
  • I have updated the project documentation to reflect my changes.

Component-specific

  • I have modified an existing component
  • I have validate Unit Tests for an existing component
  • I have added a new component
  • I have added Unit Tests for my new compontent

⏭ Next Steps

N/A

@vnbaaij vnbaaij merged commit 8071a9f into microsoft:dev Mar 4, 2024
4 checks passed
@joriverm joriverm deleted the fixes/combobox_clear branch March 20, 2024 09:19
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.

None yet

3 participants