I have a basic toggleRefinement widget using vanilla InstantSearch.js. When the toggle is switched on, only results where the facet value is
false should be shown. Using the e-commerce example terminology, I’m looking to create a toggle to “exclude free shipping”.
Pretty straightforward - I set the
on parameter in the widget to
However, when the toggle is switched on,
free_shipping=true is what gets sent to the routers
routeToState. I would expect
free_shipping=false. It appears InstantSearch is saying the “widget toggle state is true”, instead of “the facet value is false”?
Here’s a basic reproduction using the default InstantSearch v4 CodeSandbox. Note how the URL shows
free_shipping%5D=true, despite the results only showing results where
Perhaps I’m missing something super simple, but if that is indeed the expected behavior, I’d love some suggestions for how best to flip the boolean in the router.
The alternative I suppose is to adjust my records as appropriate, e.g.
free_shipping just feels so much nicer.