v2 - Conditional refinement lists
See original GitHub issueFeedback on the v2 alpha version 🆕
Describe the bug / features
Would appreciate some help with this, I’m not sure if I’m doing anything wrong or if this is intended behavior.
We have around half a dozen facets at the moment with more to come. Due to this, the UI we chose is having refinement lists hidden behind a button representing each facet. When the button is clicked, the refinement list shows below the button (think like a dropdown menu). Clicking on the button again closes the list (same as clicking anywhere outside the “box”).
There are 2 main issues with this in v2:
-
Since there is no searchStore anymore, it is not possible to get easy access to
_helper.state.disjunctiveFacetsRefinements
or_helper.state.numericRefinements
. We need this in order to “detect” if a refinement list is “active” (thus changing the button styling indicating it as active). -
When the refinement list is hidden (we use v-show to control visibility) any enabled refinements get removed automatically.
On a related note since there is no more searchStore now there is also no more toggleFacetRefinement
method. What is the recommended approach to use instead now?
How to resolve or implement the fix?
-
Do not remove active refinements when a refinement list is hidden
-
Add
disjunctiveFacetsRefinements
andnumericRefinements
(we only use these 2, not sure if there are any others that make sense) to theais-state-results
component so they can be used for conditional styling -
It would also be nice if there was a
isActive
property or something similar in theais-state-results
component (basically a boolean indicating where any part of Algolia is active; a query is present, or a refinement etc), though if the above is implemented this is simple enough to do on our own
What is the version you are using?
v2.0.0-beta.3
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:21 (8 by maintainers)
Top GitHub Comments
Hi @tcmorris, the issue you described might be linked to this one: https://github.com/algolia/vue-instantsearch/issues/575. Could you avoid to inline the
sort-by
attribute? You can store the value on the instance, it should solve the issue.Just wanted to report back that not inlining
:sort-by
per @samouss fixed the second issue. And a custom connector gets access to the underlying helper like before. Cheers.