I am using react-instantsearch and it’s fantastic, seriously great job on it.
I have a question with the refinementsList connector, though.
I am applying default refinements to the refinementsList and I’d like to prevent refinements that don’t apply from being set as defaults.
For example, I have 3 transaction status: open, pending, closed.
My defaults are open and pending. Those are applied fine.
Though what if the person doesn’t have any pending transactions? It’ll say that there are no results.
I’d like to run a check on the default refinements prior to actually applying them to prevent non-applicable filters from being applied.
So I was remembering my problem wrong.
Providing defaultRefinement will do what I was looking for but it does not trigger onSearchStateChange. Also, it still applies non-applicable filters.
I am trying to persist our filters into sessionStorage and it works great but the defaultRefinements aren’t being initially set.
I’m able to look at the Configure widget and get theSearchState, console.log it and see that the currentRefinements have been set.
How can I get defaultRefinement to trigger onSearchStateChanged?