How to apply default facet attribute value (useMenu is used)? #6547
Unanswered
BohdanYavorskyi
asked this question in
Q&A
Replies: 1 comment 9 replies
-
If you have routing, you'll want to put the ui state you want by default in the routeToState function, initialUiState gets overridden by state from routing. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
How can I apply the default facet value on initial requests? I am using the
useMenu
hook to display facet options in dropdown and I want to preselect one item on the initial request. So if the refinement option has and result it should haveisRefined: true
and just skip the filtering if no count for results.Currently, I need to make 2 calls to Algolia to achieve it. First all data and apply refine based on current refinements and options I got from 1st request.
Also I tried the
initialUiState
but I am using custom router so it skips all the params I add. I see in docs olderinstantsearch
versions haddefaultRefinements
option (or similar naming), but nothing is available now.Is it actually possible to achieve that in 1 request?
Beta Was this translation helpful? Give feedback.
All reactions