You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with the MultiSelect component, but finding that the onChange prop isn't triggering. The rest of the event handlers seem to be functioning as intended.
The onChange prop for SingleSelect is still working, so I dug into the library and compared the onChangeBroadcasters. I copied over and am testing the example code in the demo: SingleSelect Basic, MultiSelect Basic
In singleSelectBroadcastChange when determining if prev and curr values are equal:
and so running isEqual(prevOptions.values, currOptions.values) seems to always evaluate to true, which then makes shouldBroadcastChange eval to false, which causes the onChange callback to not fire. Should we be evaluating isEqual(prevOptions, currOptions) instead? Wondering if this is a bug, or if I'm misinterpreting the logic here.
Thanks!
The text was updated successfully, but these errors were encountered:
Hello!
I'm working with the MultiSelect component, but finding that the
onChange
prop isn't triggering. The rest of the event handlers seem to be functioning as intended.The
onChange
prop for SingleSelect is still working, so I dug into the library and compared the onChangeBroadcasters. I copied over and am testing the example code in the demo: SingleSelect Basic, MultiSelect BasicIn
singleSelectBroadcastChange
when determining if prev and curr values are equal:react-responsive-select/src/lib/onChangeBroadcasters/singleSelectBroadcastChange.ts
Line 12 in b40c30d
seems to check out because for example we compare object-key pairings
However in
multiSelectBroadCastChange
when looking at the equivalent boolean:react-responsive-select/src/lib/onChangeBroadcasters/multiSelectBroadcastChange.ts
Line 12 in b40c30d
We're comparing arrays, and not an object-key pairing
and so running
isEqual(prevOptions.values, currOptions.values)
seems to always evaluate totrue
, which then makesshouldBroadcastChange
eval tofalse
, which causes theonChange
callback to not fire. Should we be evaluatingisEqual(prevOptions, currOptions)
instead? Wondering if this is a bug, or if I'm misinterpreting the logic here.Thanks!
The text was updated successfully, but these errors were encountered: