-
Notifications
You must be signed in to change notification settings - Fork 516
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
Avoid to always round the range in connectRange #2498
Conversation
Deploy preview ready! Built with commit 9df4656 https://deploy-preview-2498--algolia-instantsearch.netlify.com |
src/connectors/range/connectRange.js
Outdated
@@ -100,8 +100,8 @@ export default function connectRange(renderFn) { | |||
} | |||
|
|||
return { | |||
min: Math.floor(min), | |||
max: Math.ceil(max), | |||
min: precision === 0 ? Math.floor(min) : min, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean for a precision of 1 and there 3 digits after the .
or ,
? Wouldn't it be more consistent if we were to apply the same logic based on precision?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I begin to implement it, I thought it was a bit overkill so I remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well Isn't the purpose to bring consistency? And in this case, we only have consistency for precision = 0, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then I might not have a good idea of the complexity...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I will update it 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🎉 💃
<a name=2.3.0-beta.2></a> # [2.3.0-beta.2](v2.2.1...v2.3.0-beta.2) (2017-10-24) ### Bug Fixes * **connectHierarchicalMenu:** do not return if facet not set ([#2521](#2521)) ([26e99fb](26e99fb)) * **MenuSelect:** switch from react to preact-compat ([#2513](#2513)) ([06aa626](06aa626)) * **range-slider:** add option ([#2502](#2502)) ([e78399d](e78399d)), closes [#2501](#2501) ### Features * **breadcrumb:** Add the breadcrumb widget ([#2451](#2451)) ([11d78f0](11d78f0)), closes [#2299](#2299) * **connectRange:** round the range based on precision ([#2498](#2498)) ([d4df45d](d4df45d)) * **rangeInput:** add rangeInput widget ([#2440](#2440)) ([7916d16](7916d16))
<a name=2.3.0-beta.4></a> # [2.3.0-beta.4](v2.2.4...v2.3.0-beta.4) (2017-11-13) ### Features * **core:** InstantSearch hot remove/add widgets ([#2384](#2384)) ([cfc1710](cfc1710)) <a name=2.3.0-beta.3></a> # [2.3.0-beta.3](v2.3.0-beta.2...v2.3.0-beta.3) (2017-10-25) ### Bug Fixes * **connectors:** export as well ([0b78d75](0b78d75)) ### Features * **refinementList:** add escapeFacetHits parameter ([#2507](#2507)) ([9b1b7ee](9b1b7ee)) <a name=2.3.0-beta.2></a> # [2.3.0-beta.2](v2.2.1...v2.3.0-beta.2) (2017-10-24) ### Bug Fixes * **connectHierarchicalMenu:** do not return if facet not set ([#2521](#2521)) ([26e99fb](26e99fb)) ### Features * **breadcrumb:** Add the breadcrumb widget ([#2451](#2451)) ([11d78f0](11d78f0)), closes [#2299](#2299) * **connectRange:** round the range based on precision ([#2498](#2498)) ([d4df45d](d4df45d)) * **rangeInput:** add rangeInput widget ([#2440](#2440)) ([7916d16](7916d16))
<a name=2.3.0-beta.5></a> # [2.3.0-beta.5](v2.2.4...v2.3.0-beta.5) (2017-11-16) ### Features * **core:** InstantSearch hot remove/add widgets ([#2384](#2384)) ([cfc1710](cfc1710)) <a name=2.3.0-beta.3></a> # [2.3.0-beta.3](v2.3.0-beta.2...v2.3.0-beta.3) (2017-10-25) ### Bug Fixes * **connectors:** export as well ([0b78d75](0b78d75)) ### Features * **refinementList:** add escapeFacetHits parameter ([#2507](#2507)) ([9b1b7ee](9b1b7ee)) <a name=2.3.0-beta.2></a> # [2.3.0-beta.2](v2.2.1...v2.3.0-beta.2) (2017-10-24) ### Bug Fixes * **connectHierarchicalMenu:** do not return if facet not set ([#2521](#2521)) ([26e99fb](26e99fb)) ### Features * **breadcrumb:** Add the breadcrumb widget ([#2451](#2451)) ([11d78f0](11d78f0)), closes [#2299](#2299) * **connectRange:** round the range based on precision ([#2498](#2498)) ([d4df45d](d4df45d)) * **rangeInput:** add rangeInput widget ([#2440](#2440)) ([7916d16](7916d16))
<a name=2.3.0-beta.7></a> # [2.3.0-beta.7](v2.2.5...v2.3.0-beta.7) (2017-11-20) <a name=2.3.0-beta.6></a> # [2.3.0-beta.6](v2.3.0-beta.5...v2.3.0-beta.6) (2017-11-16) ### Bug Fixes * **connectors:** prefer wrappers over bind ([#2575](#2575)) ([f8e0e00](f8e0e00)) <a name=2.3.0-beta.5></a> # [2.3.0-beta.5](v2.2.4...v2.3.0-beta.5) (2017-11-16) ### Features * **core:** InstantSearch hot remove/add widgets ([#2384](#2384)) ([cfc1710](cfc1710)) <a name=2.3.0-beta.3></a> # [2.3.0-beta.3](v2.3.0-beta.2...v2.3.0-beta.3) (2017-10-25) ### Bug Fixes * **connectors:** export as well ([0b78d75](0b78d75)) ### Features * **refinementList:** add escapeFacetHits parameter ([#2507](#2507)) ([9b1b7ee](9b1b7ee)) <a name=2.3.0-beta.2></a> # [2.3.0-beta.2](v2.2.1...v2.3.0-beta.2) (2017-10-24) ### Bug Fixes * **connectHierarchicalMenu:** do not return if facet not set ([#2521](#2521)) ([26e99fb](26e99fb)) ### Features * **breadcrumb:** Add the breadcrumb widget ([#2451](#2451)) ([11d78f0](11d78f0)), closes [#2299](#2299) * **connectRange:** round the range based on precision ([#2498](#2498)) ([d4df45d](d4df45d)) * **rangeInput:** add rangeInput widget ([#2440](#2440)) ([7916d16](7916d16))
Summary
In the
connectRange
we always round the range even with a precision greater than 0. Now we round the range only for a precision of 0 and leave the original value in the other case.Result
You can play with the
RangeInput
on dev-novel.Before:
After: