-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: fixed the onchange firing undefined #19085
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
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19085 +/- ##
==========================================
+ Coverage 84.38% 84.41% +0.03%
==========================================
Files 386 385 -1
Lines 14540 14557 +17
Branches 4802 4809 +7
==========================================
+ Hits 12269 12288 +19
+ Misses 2112 2109 -3
- Partials 159 160 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Adam Alston <[email protected]>
Co-authored-by: Adam Alston <[email protected]>
Co-authored-by: Adam Alston <[email protected]>
any updates on this fix? I'm currently blocked by this bug |
@Gururajj77 were you able to find a different approach that doesn't use a Also a reminder that this needs tests covering the interactions you describe in the PR body and in the originally linked issue. |
Yes, I've figured out a way to make it work without |
When I revert all of the code changes, the tests still pass. Shouldn't they be failing? git checkout combobox-onchange-again
git checkout main packages/react/src/components/ComboBox/ComboBox.tsx
yarn test packages/react/src/components/ComboBox/ComboBox-test.js |
Rewritten the tests, and added cases for both cases where the items are array of strings, and array of objects, to make sure all cases are covered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved my previous findings to that new issue
Hey there! v11.81.0 was just released that references this issue/PR. |
Closes #18361
bug fixes on the combobox
onChange
firing withundefined
onChange
, if the user selects an already selected it.allowCustomValue
prop.Changelog
Changed
isManualClearingRef
to keep track of the user clearing the items using the crossmark (X).InputKeydownEnter
case in the reducer, to handle the selections accordingly for both scenarios of with and withoutallowCustomValue
undefined
guards in theonStateChange
to make sure it doesn't fireonChange
withundefined
which triggers other parts of the code.clearSelection
function that is in the<ListBoxSelection />
to fire onChange withnull
.Testing / Reviewing
selectedItem: <your-selected-item>
onChange
doesn't fire again with that same itemonchange
fires with that new selected item.onChange
is fired with{ selectedItem: null, inputValue: "<your-custom-value"