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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] Fix "TypeError: Cannot read 'getBoundingClientRect' of null" #271

Merged
merged 1 commit into from Dec 14, 2019

Conversation

noratarano
Copy link
Contributor

I couldn't repro this error, but I think this should fix it.

TypeError: null is not an object (evaluating 'this.handleContainerNode.getBoundingClientRect')
  at getSliderBoundingBox (./node_modules/rheostat/lib/Slider.js:325)
  at None ([native code])
  at touch (./node_modules/rheostat/lib/Slider.js:704)
  at None ([native code])
  at this (./node_modules/rheostat/lib/Slider.js:677)
...
(2 additional frame(s) were not displayed)

By protecting access to this.handleContainerNode, we avoid this issue completely.

@ljharb @lencioni

Airbnb internal ticket: PRODUCT-49741

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

I think you could add some unit tests for all the places that return early with getSliderBoundingBox returns falsy. (the condition inside getSliderBoundingBox shouldn't happen since the set-ref method is constructor-bound :-/)

@noratarano noratarano merged commit 854ea1e into master Dec 14, 2019
@noratarano noratarano deleted the nora--fix-ref-bug branch December 14, 2019 00:21
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

2 participants