Closed Haroenv closed 3 years ago
Can you add more info @Haroenv? Have you checked the implementations in instantsearch.js and in angular?
In InstantSearch.js and Angular we don't follow InstantSearch.css, we only show the "computed label", which doesn't include the attribute name.
Compare React InstantSearch (correct): https://community.algolia.com/react-instantsearch/storybook/?selectedKind=CurrentRefinements&selectedStory=with%20HierarchicalMenu&full=0&addons=1&stories=1&panelRight=1&addonPanel=storybooks%2Fstorybook-addon-knobs
to InstantSearch.js (missing attribute): https://community.algolia.com/instantsearch.js/v2/dev-novel/?selectedStory=CurrentRefinedValues.with%20clearsQuery
the InstantSearch.js example doesn't have a HierarchicalMenu, but the problem is already clear without
Here's a better example of InstantSearch.js's behaviour with hierarchical menus: https://codesandbox.io/s/k3zovlx2v5
Note that with the data given in the connector (posted in OP), you can't make the same behaviour as React InstantSearch
It's a limitation of the current design of InstantSearch.js. The values are that the currentRefinements get are from the search state (helper) which does not contain any information about the widget that defined it.
A better way to handle that is to be able to retrieve the UI state from all the widgets without any filters from the user. We could that by moving this method to the instantsearch instance and then make the RoutingManager use it as well as the currentRefinements widget.
With that you are able to implement a generic "template" that can work with all the default widgets.
Did I miss something? Would that be enough information?
Is your issue solved with InstantSearch.js 3, @Haroenv?
The label is no longer computed, meaning you get a whole "breadcrumb", but I don't think this is fully solved, because it doesn't list the other levels so you can't unrefine to a particular level.
I think the issue is a lot smaller now than it used to be when I opened this issue.
Changed my mind as nobody asked for a breadcrumb inside current refinements, that's solved with using a separate breadcrumb.
Current refinements indeed now includes the attribute in the rendering, which solves most of this initial issue
Here I can't make a breadcrumb (note that what I refined was at
lvl1
, notlvl0
).I can't simply use the breadcrumb component either, since I don't have the same levels available, and a menu also uses
type: hierarchical