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

useGeolocation not updating state in Firefox desktop #412

Open
joekrill opened this issue May 4, 2023 · 1 comment
Open

useGeolocation not updating state in Firefox desktop #412

joekrill opened this issue May 4, 2023 · 1 comment

Comments

@joekrill
Copy link

joekrill commented May 4, 2023

Describe the bug

In Firefox the state returned by useGeolocation is never updated when permission is requested and given. It will only update if permission is given permanently and the page is then reloaded (or the component using the hook is remounted).

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://antonioru.github.io/beautiful-react-hooks/#/useGeolocation
  2. Click "Allow" when location permission is requested.
  3. Notice the text never changes from "Retrieving position..."

Expected behavior

The state should update and the location should be shown as soon as it's retrieved.

I've tested this using:

  • Firefox 112.0.2 (64-bit) on Mac M1 Ventura 13.3.1 (22E261)
  • Firefox 108.0.1 (64-bit) on Windows 10 Pro 21H2

This issue did not occur on my Pixel 7 with Firefox 112.2.0 (running Android UpsideDownCake beta UPB1.230309.017)

Additional context

Oddly, using useGeolocationState directly does work as expected (although the examples are currently broken). And the events returned are triggered (i.e. onChange).

@JayV30
Copy link

JayV30 commented Aug 9, 2024

I'm also experiencing issues with useGeolocation. The component where it's being used correctly reports position data when the component mounts. Then if the component unmounts, returning to that component no position data is returned. It doesn't appear to be limited to Firefox, this is occurring in Chrome.

I love beautiful-react-hooks and generally use it in most of my projects but there is something just not working right with this particular hook.

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

No branches or pull requests

2 participants