Navigation Menu

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(react): export InstantSearchApi type #5518

Merged
merged 1 commit into from Mar 1, 2023

Conversation

francoischalifour
Copy link
Member

As discussed internally, exporting the InstantSearchApi is handy in consumers app to make sure that types are fully consistent.

As an example, there are a few unintended bugs on the dashboard search because they use their own SearchResults type for useInstantSearch().results, and they assumed that it can be null when loading. But it doesn't, RISHooks always exposes a fallback results object.

Consumer apps will now be able to rely on things like InstantSearchApi['results'] to minimize this kind of errors.

I also defaulted the generic to UiState so that it can be used just like useInstantSearch() which is already defaulted.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 1, 2023

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 f3f1ddf:

Sandbox Source
InstantSearch.js Configuration
react-instantsearch-app Configuration
example-react-instantsearch-hooks-default-theme Configuration
example-vue-instantsearch-default-theme Configuration

@Haroenv Haroenv enabled auto-merge (squash) March 1, 2023 16:15
@Haroenv Haroenv merged commit 27b478f into master Mar 1, 2023
4 checks passed
@Haroenv Haroenv deleted the feat/export-InstantSearchApi branch March 1, 2023 16:27
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