-
Notifications
You must be signed in to change notification settings - Fork 748
Picker dialog dismiss bug #3858
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
base: master
Are you sure you want to change the base?
Conversation
|
@yotam-wix please merge master after the monorepo change 🙏 |
634a5c1 to
ceedda9
Compare
|
#rebuild |
@M-i-k-e-l done |
|
@yotam-wix you forgot to assign it to me, I'll look at it next week |
M-i-k-e-l
left a comment
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.
Nice work !
| ref={pickerExpandable} | ||
| useDialog={useDialog || useWheelPicker} | ||
| dialogProps={DEFAULT_DIALOG_PROPS} | ||
| dialogProps={{...DEFAULT_DIALOG_PROPS, onDismiss: handleCancelAction}} |
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.
You're creating a new object each render
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.
@M-i-k-e-l Would a better solution be to create a memoized value using useMemo for this object of dialogProps that re-calculates for each change in handleCancelAction?
|
|
||
| const cancelSelect = useCallback(() => { | ||
| handleCancelAction(); | ||
| pickerExpandableRef.current?.closeExpandable?.(); |
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.
This fix changes the order of topBarProps?.onCancel?.(); and pickerExpandableRef.current?.closeExpandable?.();.
Although I could not find a bug with it, it does not mean it does not break anything.
I am not saying that we have to find another solution but we should be aware of this and possibly try to find a solution that does not change the order.
| [multiDraftValue]); | ||
|
|
||
| const cancelSelect = useCallback(() => { | ||
| const handleCancelAction = useCallback(() => { |
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 don't really know what is the difference between handleCancelAction and cancelSelect (name wise), try to think of a better name
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.
will change it to resetSelectionState if that makes sense
Description
Fixed Picker dialog bug where on dismiss it 'remembers' the selected values.
Changelog
Picker - Fixed dialog onDismiss bug.
Additional info
Ticket 4680