Skip to content

Question re custom routing with statemapping #5319

Answered by Haroenv
landermedia asked this question in Q&A
Discussion options

You must be logged in to vote

There's a couple very small confusions that happened to make your example not working:

  1. the UiState type from react-instantsearch-core isn't compatible with the type of InstantSearch.js or React InstantSearch hooks, it's a completely different shape
  2. initialUiState is not compatible with routing. It's only used if there are no routing parameters
  3. because of the type being slightly wrong, you didn't get notified ui state is actually nested per index

A working example is https://codesandbox.io/s/upbeat-diffie-126rrb?file=/App.tsx

Note that there's a small thing I noticed is that while the InstantSearch type is generic to allow a different route state than ui state, it wasn't yet allowed in R…

Replies: 0 comments 10 replies

Comment options

You must be logged in to vote
9 replies
@landermedia
Comment options

@Haroenv
Comment options

@landermedia
Comment options

@Haroenv
Comment options

@landermedia
Comment options

Answer selected by landermedia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Library: React InstantSearch ≥ 7 Issues in any of the react-instantsearch@7 packages (formerly named react-instantsearch-hooks)
2 participants