Skip to content
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

Merged
merged 5 commits into from
May 5, 2021
Merged

feat(core): add getUiState function #4750

merged 5 commits into from
May 5, 2021

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Apr 28, 2021

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.

This is useful for if you want to read the ui state externally from InstantSearch, like for example in algolia/autocomplete#550

TODO: tests
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 28, 2021

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:

Sandbox Source
InstantSearch.js Configuration

@francoischalifour
Copy link
Member

That'll be useful for external integrations to read the InstantSearch internal state! 🙂

Haroenv added 2 commits April 29, 2021 18:00

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@Haroenv Haroenv marked this pull request as ready for review April 30, 2021 12:05
@@ -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');
Copy link
Member

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?

Copy link
Contributor Author

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>
@Haroenv Haroenv merged commit adce212 into master May 5, 2021
@Haroenv Haroenv deleted the feat/getUiState branch May 5, 2021 12:32
francoischalifour added a commit to algolia/autocomplete that referenced this pull request May 6, 2021
In algolia/instantsearch#4750 we introduced the `getUiState` API which allows to retrieve the current category more easily.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants