Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing is not working while a custom onStateChange props is defined #6087

Open
1 task done
matthieupinte opened this issue Mar 15, 2024 · 0 comments
Open
1 task done
Labels
triage Issues to be categorized by the team

Comments

@matthieupinte
Copy link

matthieupinte commented Mar 15, 2024

馃悰 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
Screenshot 2024-03-15 at 09 32 59

With routing
Screenshot 2024-03-15 at 09 33 51

Seems related to #4795

CodeSandbox sample:
https://codesandbox.io/p/sandbox/hungry-borg-tkntsx?file=%2Fsrc%2FApp.tsx

馃攳 Steps to reproduce

  1. Set a <InstantSearch routing> component in your page, with some widgets like refinementList or other
  2. Set a initialUiState props (ex: initialUiState={{ 'YOUR_INDEX': { refinementList: { ATTRIBUTE: ['VALUE'] } }}
  3. Set a custom onStateChange={({ uiState, setUiState }) => setUiState(uiState)} props

Live reproduction

https://codesandbox.io/

馃挱 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
@matthieupinte matthieupinte added the triage Issues to be categorized by the team label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Issues to be categorized by the team
Projects
None yet
Development

No branches or pull requests

1 participant