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(metadata): ensure safe user agent detection #993

Merged
merged 2 commits into from
Jun 27, 2022
Merged

Conversation

sarahdayan
Copy link
Member

Summary

This ensures user agent detection doesn't break in non-browser environments.

In React Native, window.navigator is polyfilled with a custom product property, and doesn't have other properties traditionally exposed in the browser.

This change ensures this code path doesn't yield a runtime error regardless of the environment.

fixes #992

@codesandbox-ci
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 18e7694:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
algolia/autocomplete Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-vue Configuration

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 24, 2022

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 18e7694:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
algolia/autocomplete Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-vue Configuration

@sarahdayan sarahdayan merged commit fdf2b34 into next Jun 27, 2022
@sarahdayan sarahdayan deleted the fix/no-useragent branch June 27, 2022 12:29
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.

Autocomplete Core + React Native throws because of missing userAgent
3 participants