How to use initialUiState and a custom router at the same time ? #4455
Replies: 2 comments 3 replies
-
Hey, I'm working with @tristanbes and I'm the one which faced the problem. I think I should have open an issue myself instead of asking him to do it, on something he didn't work on 😅 We are using vue-instantsearch but I'm 100% the issue comes from instantsearch.js and not the Vue wrapper. So, we want to use We are able to give However, when I'm looking at the devtools, I can see that the We use a custom router with a custom state mapping, so I thought the issue could come from it. And bingo, I've made a test by updating The country I don't think we can't prevent the URL to be altered since we did our logic inside our custom router, so the question is how to use the PR/issue related:
Thank you! |
Beta Was this translation helpful? Give feedback.
-
This is actually something which I suggested in #4395 (but not the whole team agreed that this is the right heuristic). If you think that this might be fixing your use case specifically, we might merge that. It might still be needed to merge deeper within the UiState, to e.g. merge separate values for refinement list, maybe per attribute? For now we consider that uiState is atomic per index, and doesn't get merged inside the index. This means that state from a router on a specific index will override the initial UI state. This means that the PR you found indeed works, and never was reverted, except that it doesn't merge deeply. Could you explain what exactly your use case is for ui state which conflicts with router? Our previous position was that you use initialUiState for things which you can use routing for too, therefore the routing should take priority, but we might have missed a use case. Thanks for raising this in any case, we always love when you come with a very detailed issue! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm looking for an explanation on how to use
initialUiState
with a custom router;I'm trying to set default values for the country filter, based on the country the user lives in and make it work with the custom router;
We've tried witout success:
Beta Was this translation helpful? Give feedback.
All reactions