algolia / instantsearch

⚡️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/
MIT License
3.68k stars 514 forks source link

fix(routing): warn if initialUiState is used #6238

Closed Haroenv closed 3 months ago

Haroenv commented 3 months ago

Summary

If you use initialUiState, as well as routing, you can get some confusing situations where the state is overridden, only if routing actually has some state. This can be very sporadic depending on your setup, and thus confusing.

Result

CR-6027 is somewhat handled, documentation still needed.

If you have any state set in intialUiState (not an empty object), you will receive a warning upon initialisation of InstantSearch with routing.

codesandbox-ci[bot] commented 3 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9baeb472367f509091c05cd0f7ad2e4d4095beb5:

Sandbox Source
example-instantsearch-getting-started Configuration
example-react-instantsearch-getting-started Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-react-instantsearch-next-routing-example Configuration
example-vue-instantsearch-getting-started Configuration