Closed ghost closed 9 years ago
Hi @Evne-front,
indeed we fixed a bug around the numeric refinements a few weeks ago and the ion.rangeslider demo wasn't reseting the numerical refinement. It seems our demo code (https://github.com/algolia/instant-search-demo/blob/master/js/app.js#L146-L153) has not been updated; I'm updating it now.
Your fix is good btw :)
Arg wait, the real fix is:
onFinish: function(data) {
var lowerBound = state.getNumericRefinement(facetName, '>=');
lowerBound = lowerBound && lowerBound[0] || data.min;
if (data.from !== lowerBound) {
algoliaHelper.removeNumericRefinement(facetName, '>=');
algoliaHelper.addNumericRefinement(facetName, '>=', data.from).search();
}
var upperBound = state.getNumericRefinement(facetName, '<=');
upperBound = upperBound && upperBound[0] || data.max;
if (data.to !== upperBound) {
algoliaHelper.removeNumericRefinement(facetName, '<=');
algoliaHelper.addNumericRefinement(facetName, '<=', data.to).search();
}
}
When you try to change a range distance few or more times,the minimal value reset and the maximum value become NaN. Here is my solution to resolve this problem.