meilisearch-js-plugins
meilisearch-js-plugins copied to clipboard
keepZeroFacets not keeping facets with 0 matches when using custom search method with search client
Description
Hello, I am trying to preserve the facets from my RefinementList when I select one, but the ones which are not selected disappear.
Let's say we have 3 categories - clothes, shoes, and accessories, clicking on "clothes" would hide shoes and accessories until I unselect clothes
I saw in the README that you could provide a keepZeroFacets
property to the client since version 0.6.2
I updated my client, set the property to true, and also made sure that my attributes are filterable in the backend. Still, I can't retain the non-chosen categories in the RefinementList
Expected behavior
As the documentation from README states, I expected that after a refinement, facets/filters with 0 matches would still appear in the list
Current behavior
As described, currently when refinement finishes, my RefinementList the items
prop contains only the currentRefinement (for example the selected category - clothes)
Steps to reproduce
Thankfully I managed to reproduce this in a code sandbox here
Environment
- OS: EndeavourOS
- Browser: Chrome Version 102.0.5005.115 (Official Build) (64-bit)
- Meilisearch version: 0.26.1
- instant-meilisearch version: 0.6.2
We have the same problem, the none selected facets disappear when one is selected in our refinementList. Is there any fix yet?
Hey! I think this might be linked to #775 but I'm not sure! I will investigate this issue after the pre-release of Meilisearch v0.28.0 ( after 11 july)
in our case we don't use placeholdersearch: false
as mentioned in #775
We have operator: "or"
and keepZeroFacets: true
inside our refinementList
So maybe it's the operator
that's not working?
Are you using react by any chance?
I am using react and no matter what I try I can't get 0 facets.
Are you using react by any chance?
Thanks @ar-siddiqui there seems to be an issue with how React understands the conditionals of facets.
Hey @impzero could you try your bug again with the latest release (v0.8.2) ?
Should be fixed! If it is not, please tell me and re open :)