-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add getUiState function #4750
Conversation
This is useful for if you want to read the ui state externally from InstantSearch, like for example in algolia/autocomplete#550 TODO: tests
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 e56bd0c:
|
That'll be useful for external integrations to read the InstantSearch internal state! 🙂 |
@@ -101,6 +103,9 @@ See: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend | |||
}); | |||
|
|||
it('throws if insightsClient is not a function', () => { | |||
const warn = jest.spyOn(global.console, 'warn'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need these changes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a continuation of #4746, the warnings now take up a lot of place, so I removed them from this file.
Co-authored-by: François Chalifour <francoischalifour@users.noreply.github.com>
In algolia/instantsearch#4750 we introduced the `getUiState` API which allows to retrieve the current category more easily.
Summary
This is useful for if you want to read the ui state externally from InstantSearch, like for example in algolia/autocomplete#550
Result
a new
getUiState
function on the InstantSearch instance that can be used to retrieve the latest ui state, separately from the router.