I can see that there is an defaultRefinement option on the react widget hierarchicalMenu, but I can't find it in the .js docs. Is there an equivalent in .js?
If not, is there a workaround?
instantsearch.widgets.hierarchicalMenu({
container: '#ais-filterCatMenu',
defaultRefinement: 'Sofa > Sovesofa',
attributes: [
'categories.lvl0',
'categories.lvl1',
],
...
}),
With Instantsearch.js you can define an
initialUiState
when initializing the search client. https://www.algolia.com/doc/api-reference/widgets/instantsearch/js/#widget-param-initialuistateI found the source of https://instantsearchjs.netlify.app/stories/?path=/story/refinements-hierarchicalmenu--with-default-selected-item on their github repo here
For example you can do something like this
which will end up looking like this.