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

fix(perf): only compute snappoints when step is provided #2699

Merged
merged 6 commits into from
Feb 11, 2018
Merged

Conversation

bobylito
Copy link
Contributor

@bobylito bobylito commented Feb 8, 2018

This keeps the snapping but does not generate the snap points if no value is provided. We can do that because rheostat snaps the point to the rounded value by default (if snap=true). Until rheostat provides a lazy way to fix the snappoints, there will be a risk of having an "out of memory" error because the range of values can be too big. There is an open issue opened for adding this new API: airbnb/rheostat#14 but it's uncertain if someone will work on it.

Fix #2662

Alex S and others added 3 commits February 8, 2018 16:19
This keeps the snapping as it snaps points to the rounded number if
no snappoints are provided. Until rheostat provides a lazy way to fix
the snappoints, there will also be a risk of having an "out of memory"
error because the range of values is too big. There is an open issue
opened for adding this new API: airbnb/rheostat#14

Fix #2662
@algobot
Copy link
Contributor

algobot commented Feb 8, 2018

Deploy preview for algolia-instantsearch ready!

Built with commit c511df2

https://deploy-preview-2699--algolia-instantsearch.netlify.com

@algobot
Copy link
Contributor

algobot commented Feb 8, 2018

Deploy preview for algolia-instantsearch ready!

Built with commit a821f78

https://deploy-preview-2699--algolia-instantsearch.netlify.com

@@ -55,6 +55,7 @@ export class RawSlider extends Component {

// creates an array of values where the slider should snap to
computeSnapPoints({ min, max, step }) {
if(!step) return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is not valid to our linter, might do:

if (step) {
  return [...range(min, max, step), max];
}

@iam4x
Copy link
Contributor

iam4x commented Feb 8, 2018

Impressive debugging @bobylito you nailed it 💯

Haroenv
Haroenv previously requested changes Feb 9, 2018
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

This is great, and a right way to go for it.

A good workaround for now, but I wonder if an option would be to implement airbnb/rheostat#14 🤔

Anyway, according to travis you still need to update the snapshots

@bobylito
Copy link
Contributor Author

Anyway, according to travis you still need to update the snapshots

done

A good workaround for now, but I wonder if an option would be to implement airbnb/rheostat#14 🤔

Yes. That could be the end game. Let's move forward with this one. I dismiss your review @Haroenv ;)

@bobylito bobylito dismissed Haroenv’s stale review February 11, 2018 21:01

Taken into account. The fix in rheostat is a longer term solution.

@bobylito bobylito merged commit ce9ca19 into develop Feb 11, 2018
@bobylito bobylito deleted the perf/slider branch February 11, 2018 21:02
bobylito pushed a commit that referenced this pull request Feb 13, 2018
<a name=2.5.1></a>
## [2.5.1](v2.5.0...v2.5.1) (2018-02-13)

### Bug Fixes

* **perf:** only compute snappoints when step is provided ([#2699](#2699)) ([ce9ca19](ce9ca19)), closes [#2662](#2662)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Browsers crash if too many widgets are created.
4 participants