You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
When using the ToggleRefinement widget with the routing enabled (following the Routing URLs
guide in the documentation) then the toggle parameter is passed as a string to the widget instead of a boolean.
And when refreshing the page the checkbox is always checked (since we receive the "false" string which is truthy).
This is because the qs module parses the url parameters as string by default (ljharb/qs#91). You can fix this by using qs.decoder (ljharb/qs#91 (comment)) but this is not very convenient (and not precised in the documentation).
This is something that we are already doing for a couple of widgets e.g. RefinementList. We can implement the logic inside the getCurrentRefinement function of the ToggleRefinement connector.
Describe the bug 🐛
When using the ToggleRefinement widget with the routing enabled (following the Routing URLs
guide in the documentation) then the toggle parameter is passed as a
string
to the widget instead of aboolean
.We got this warning from React:
And when refreshing the page the checkbox is always checked (since we receive the
"false"
string which is truthy).This is because the qs module parses the url parameters as string by default (ljharb/qs#91). You can fix this by using
qs.decoder
(ljharb/qs#91 (comment)) but this is not very convenient (and not precised in the documentation).To Reproduce 🔍
Steps to reproduce the behavior:
Expected behavior 💭
The
toggle
parameter should be correctly passed to the widget as aboolean
.Environment:
The text was updated successfully, but these errors were encountered: