useGeolocation: Check for support not robust enough#191
Merged
childrentime merged 1 commit intochildrentime:mainfrom Mar 5, 2026
Merged
useGeolocation: Check for support not robust enough#191childrentime merged 1 commit intochildrentime:mainfrom
childrentime merged 1 commit intochildrentime:mainfrom
Conversation
childrentime
added a commit
that referenced
this pull request
Mar 5, 2026
Co-Authored-By: brandoningli <6826623+brandoningli@users.noreply.github.com>
childrentime
added a commit
that referenced
this pull request
Mar 5, 2026
Co-Authored-By: brandoningli <6826623+brandoningli@users.noreply.github.com>
childrentime
added a commit
that referenced
this pull request
Mar 5, 2026
Co-Authored-By: brandoningli <6826623+brandoningli@users.noreply.github.com>
Owner
|
Thank you, I'll release a new version later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've been running into an issue where we're getting an error that
undefined is not an objectwhen evaluatingnavigator.geolocation.getCurrentPositionin theuseGeolocationhook. It turns out that the current check for support is not robust enough.This PR introduces a more extensive check to make sure the requisite functions are actually provided by the browser before attempting to use them. It also adds a try/catch to
useSupportedto treat anything that throws an error as failing the support check.I've patched this check into my codebase and it seems to resolve the issue we're having.