fix: allow FluentCombobox to be cleared from code
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
- [x] I have tested my changes.
- [x] 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
- [x] I have modified an existing component
- [ ] I have added a new component
- [ ] I have added Unit Tests for my new compontent
- [ ] I have validate Unit Tests for an existing component
⏭ Next Steps
N/A