Skip to content

fix(metadata): ensure safe user agent detection#993

Merged
sarahdayan merged 2 commits intonextfrom
fix/no-useragent
Jun 27, 2022
Merged

fix(metadata): ensure safe user agent detection#993
sarahdayan merged 2 commits intonextfrom
fix/no-useragent

Conversation

@sarahdayan
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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 requested a review from dhayab June 24, 2022 08:44
@sarahdayan sarahdayan requested a review from Haroenv June 24, 2022 09:07
@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