Routing is not working while a custom onStateChange props is defined
matthieupinte opened this issue Β· comments
π Current behavior
When we define a custom onStateChange
props, url query params are not "set" on load via routing={true}
.
If not, routing={true}
works as expected with default query params
At load:
With onStateChange={({ uiState, setUiState}) => setUiState(uiState)} routing
Seems related to #4795
CodeSandbox sample:
https://codesandbox.io/p/sandbox/hungry-borg-tkntsx?file=%2Fsrc%2FApp.tsx
π Steps to reproduce
- Set a
<InstantSearch routing>
component in your page, with some widgets likerefinementList
or other - Set a
initialUiState
props (ex:initialUiState={{ 'YOUR_INDEX': { refinementList: { ATTRIBUTE: ['VALUE'] } }}
- Set a custom
onStateChange={({ uiState, setUiState }) => setUiState(uiState)}
props
Live reproduction
π Expected behavior
We expect to see url params reflecting our uiState, even if we set a custom onStateChange
props on InstantSearch
component.
Package version
react-instantsearch v7.7.0
Operating system
No response
Browser
No response
Code of Conduct
- I agree to follow this project's Code of Conduct