Skip to content

WheelPicker (incubator) - fix updates #1693

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

Merged
merged 2 commits into from
Dec 1, 2021
Merged

Conversation

Inbal-Tish
Copy link
Collaborator

Description

WheelPicker (incubator) - allow 'items' change; block 'onChange' call when 'initialValue' change.

Changelog

WheelPicker (incubator) - allow 'items' change; block 'onChange' call when 'initialValue' change.

Copy link
Collaborator

@ethanshar ethanshar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
Wrote a single comment


if (prevInitialValue.current !== initialValue) {
// don't invoke 'onChange' if 'initialValue' changed
prevInitialValue.current = initialValue;
Copy link
Collaborator

@ethanshar ethanshar Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't set the prevInitialValue value here just because scrollToIndex method is being called in several places.
Instead I'd set in the useEffect that handle the initialValue update (right after triggering the scroll)

Copy link
Collaborator Author

@Inbal-Tish Inbal-Tish Nov 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand. In all other cases, it should not pass the condition...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but technically the responsibility for re-setting the prevInitialValue is in the relevant useEffect and not in the method it calls to.
If someone will change the implementation of scrollToIndex they might break the functionality of prevInitialValue

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how it works... Let's talk when you're available

@ethanshar ethanshar added the Important for Next Release PR that must be included in the release version label Nov 28, 2021
@Inbal-Tish Inbal-Tish requested a review from ethanshar November 29, 2021 07:14
@ethanshar ethanshar merged commit a38dab3 into master Dec 1, 2021
@Inbal-Tish Inbal-Tish deleted the fix/WheelPicker_updates branch December 6, 2021 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants