fix(Dropdown,Combobox): fixed selection lost updating ListItems when using reactive forms or ngModel#3377
fix(Dropdown,Combobox): fixed selection lost updating ListItems when using reactive forms or ngModel#3377Licen-it wants to merge 11 commits into
Conversation
✅ Deploy Preview for carbon-components-angular ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…using reactive forms or ngModel
… + fixed some stories
…with the falsy value
| protected _isFocused = false; | ||
|
|
||
| private _writtenValue: any; | ||
| private _isUsingReactiveForms = false; |
There was a problem hiding this comment.
Based on the changes in this file, I'm confused why this variable is called _isUsingReactiveForms. The changes made also impact Template driven forms.
So the question is, do we even need this check/variable? Shouldn't it be fixed for when we have one-way binding as well (non-reactive/non-template-driven -- passing in value and listening for change, updating value)?
There was a problem hiding this comment.
Well...considering there is no input that can be used to pass the selection, yes we do need it. My suggestion for the next major is to remove the selected property from the listItem and have it handled as a separate input that would work in tandem with the writeValue flow bringing back the component to only have one source of truth for the selected values
There was a problem hiding this comment.
Maybe instead of _isUsingReactiveForms, should name it as _isUsingNgControl since it's being applied to both template-driven & reactive forms.
| // primarily used to capture and propagate input to `writeValue` before the content is available | ||
| private _writtenValue: any = []; | ||
|
|
||
| private _isUsingReactiveForms = false; |
There was a problem hiding this comment.
Same comment as above _isUsingReactiveForms.
Closes #3376
Closes #3389
Fixed the selection lost when updating the ListItems
Changelog
Changed