-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(numericRefinementList): Correctly apply active class
Fixes #1010 The `shouldComponentUpdate` of `RefinementList` was checking if the `facetValues` from the props where actually changed before issuing a new rendering. It turns out that in `numericRefinementList`, the new `facetValues` was always equal to the already set one. More precisely, the filters seemed to already be set in the props before reaching `shouldComponentUpdate`. Turns out that we were editing a variable in place instead of working on a copy so the internal props where changing without the component really noticing. I updated the `render` method of the `numericRefinementList` to pass a new array instead of working on the same copy over and over again. I refactored the `shouldComponentUpdate` and `_toggleRefinement` methods by splitting in several variables in my quest to find the issue. Thought I might keep it that way. I added an explicit regression test to make sure we are really not touching existing variables. Now the current and next props are really different, and the full render is propagated and the correct classes applied.# Possible types : feat, fix, refactor, chore, style, perf, test, docs
- Loading branch information
1 parent
6b8e34e
commit 7cca9a4
Showing
3 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters