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

fix(insights): do not throw if insightsClient is undefined in server environments #1220

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

dhayab
Copy link
Member

@dhayab dhayab commented Nov 17, 2023

Summary
The Autocomplete Insights plugin can be initialized without an insights client, which will dynamically retrieve at runtime. This only works in browser environments, but later parts of the plugin init code wrongly assumed the insightsClient to have been retrieved.

This PR fixes this issue by returning an empty Insights plugin in server environments if insightsClient hasn't been explicitly provided.

Fixes #1218

@dhayab dhayab requested review from a team, sarahdayan and aymeric-giraudet and removed request for a team November 17, 2023 16:18
Copy link

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

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
@algolia/autocomplete-example-vue Configuration

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.

"insight:true" shows error in createAutocomplete with NextJS React18
2 participants