Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Table] Fix onSelection being called too much in controlled mode #1595

Merged
merged 1 commit into from Sep 22, 2017

Conversation

cmslewis
Copy link
Contributor

@cmslewis cmslewis commented Sep 21, 2017

Fixes #1529

Checklist

  • Include tests

Changes proposed in this pull request:

  • 馃悰 FIXED Table no longer invokes onSelection excessively on mousemove when selectedRegions is controlled.

Reviewers should focus on:

  • Before, I was comparing the next selectedRegions candidate to this.props.selectedRegions under the assumption that the prop would contain the last emitted value. That obviously doesn't hold up when selectedRegions is controlled.
  • Now, I'm keeping a lastEmittedSelectedRegions instance variable in DragSelectable. I compare the current selectedRegions candidate to this old value to determine whether I should invoke onSelection again. If the values are deeply equal, I don't invoke.
    • Does that sound good?

Screenshot

2017-09-21 15 21 15

@blueprint-bot
Copy link

Fix onSelection being called too much in controlled mode

Preview: documentation | table
Coverage: core | datetime

@cmslewis cmslewis merged commit 8c40f26 into master Sep 22, 2017
@cmslewis cmslewis deleted the cl/table-1529-selection-controlled-mode branch September 22, 2017 18:51
@llorca llorca mentioned this pull request Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants