How to sync custom parameter in InstantSearch uiState with custom connector #5501
Replies: 2 comments 4 replies
-
Some new informations : In However, we do not unsertand why but if we do not call All these seems a little bit hacky, I am sure we are missing something from your custom connector architecture. |
Beta Was this translation helpful? Give feedback.
-
Some more informations about to the infinite loop (which is in fact not linked to the custom Connector subject).As for this problem, it was coming from the fact that we are hiding the So, every time we are changing the display, It is a side question but, why |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
We are trying to move from react-instantsearch-dom to react-instantsearch-hook-web but we are having a hard time converting our custom connectors.
Previously, we had a custom connector used for rendering capability only (Choose to display Hits in grid or list), so it was not modfifying the Algolia query.
The connector state was stored in InstantSearch state so everytime the user refine the value, we will store his decision in the browser URL. (Thanks to
refineValue(searchState, nextValue, context, resetPage)
)We followed the tutorial here https://www.algolia.com/doc/guides/building-search-ui/widgets/create-your-own-widgets/react-hooks/ and we read your answers here and here :
#5344
#5345
However, we still do not succeed to have a state (not linked to the Query SearchParameters) stored in InstantSearch state.
We tried to add the state in
SearchParameters
anduiState
but Algolia complain saying it is an Uknown parameter. We understand this error message as it is not a SearchParameter that we can send through Algolia API.Then, we tried to store the value of the widget inside the connector through a local variable
widgetState
.It seems to work a little bit as we can create/call a
refine
method. It is changing the value returned by theuse***
but it does not update the URL query parameters.If you have any tips about having a custom state property synchronized in InstantSearch state / URL routing, we will be glad yo hear.
Thanks in advance for your help.
Yours faithfully,
LCDP
Beta Was this translation helpful? Give feedback.
All reactions