Is it not possible to set the default sort order on the initial ui state? #6683
-
We use the hook implementation for wrapping custom MUI components with instantsearch context. Is there not a way to set the default sort refinement in the initial ui state? Maybe I am missing something from the documentation, but it didn't look like this was available. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
What do you mean, do you mean the sortBy parameter of refinementList? If so that parameter is indeed not synchronised with the URL, and you just pass it as an argument to the widget |
Beta Was this translation helpful? Give feedback.
-
When the component is rendered to provide context for all the other components / hooks, I do not see a way to set the default sort refinement. We use the useSortBy hook to sort by certain fields on various wrapped UI components, but this still requires the user to interact.
What I am referring too is the initial setup, this is an example:
|
Beta Was this translation helpful? Give feedback.
initialUiState={{ [searchIndex]: { sortBy: 'myOtherSortIndex' }}
documentation: https://www.algolia.com/doc/api-reference/widgets/ui-state/react/