Replies: 6 comments
-
Yes, that's something I wanted as well. Also, most of the time you're using a single operator and want to switch from 1 refinement to another. Like you're filtering with |
Beta Was this translation helpful? Give feedback.
-
It isn't, we're now using an array of refinements by operator ( https://github.com/algolia/algoliasearch-helper-js/blob/d3bf223fcfe9da6a4a47c2349d758d402d67729a/dist/algoliasearch.helper.js#L8177 ) and all the other ones use the value to know which one to add/remove, so I wouldn't change the behaviour for this method only, but we could probably add a 4th parameter |
Beta Was this translation helpful? Give feedback.
-
Or maybe another method, because optional 4th parameter is not super nice :/ helper.toggleNumericRefinement(attribute, operator, value);
// and maybe
helper.switchNumericRefinement(attribute, operator, value); // clear + add ? |
Beta Was this translation helpful? Give feedback.
-
I like the switch method. This is pretty common to use this clear + add pattern. My concern would be that it's yet another kind of method. What do you think? |
Beta Was this translation helpful? Give feedback.
-
Yes true; maybe we should just go for toggle then. Even if the switch is a common pattern, we can definitely call |
Beta Was this translation helpful? Give feedback.
-
Maybe we could have that in the next major release and rethink the method names? |
Beta Was this translation helpful? Give feedback.
-
Here is what we currently have:
toggleRefinement
toggleRefinement
toggleRefinement
toggleFacetExclusion
{add,remove}
toggleTag
We should probably add
toggleNumericRefinement
for consistency.Beta Was this translation helpful? Give feedback.
All reactions