Repository navigation
[EuiButtonGroup] Ensure onChange is called only once - #5033
Conversation
jenkins test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5033/ |
cee-chen
left a comment
There was a problem hiding this comment.
QA'd locally in Kibana and against an Enterprise Search branch (that also reported this issue) and can confirm onChange is now only firing once. Thanks a million Greg!
One non-blocking comment on this PR - it always gives me a small amount of concern when I see a bug fix or functional change go in without a corresponding unit/jest test written - it might be nice someday to see a spec file written for button_group_button!
Agreed. We're limited by enzyme here, though, because there's no way (that I've found) to test the |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5033/ |
|
Ahh gotcha! Huge thanks for the explanation, I hadn't grokked the code deeply enough to realize that was what was happening! |
Summary
Fixes #4961, in which an EuiButtonGroup with
type=singlewould fire theonChangecallback twice for click events.The fix is to remove the
onClickhandler fortype=singlegroups because alabelclick will automatically call theinputelement'sonChangehandler.Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for the any docs examples- [ ] Added or updated jest tests