Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There had been a persistent bug in which handles on the date slider don't appear in their proper locations on initial page load, ie:
I tracked this issue down to a side effect of their being two initial renders of the Slider component. The second caused by Slider updating its internal state when it profiles how wide its container is. The first render had
offset
(which determines handle placement) set to[0,0]
while the second render hasoffset
set properly. This should have been okay, however, for some reason, React's reconciliation wasn't updating the DOM properly upon second render.I first tried to fix the reconciliation angle, but couldn't sort it out. This PR removes
_handleResize
method and instead fixes pixel dimensions on initial load. This should always be okay for us, as Slider is never resized responsively. This has the side effect of removing unnecessary rerenders of Slider during app use.I also took this opportunity to lint
Slider.js
to modernize it to ES6 standards.