beautiful-react-hooks
beautiful-react-hooks copied to clipboard
`useGeolocation` not updating state in Firefox desktop
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:
- Go to https://antonioru.github.io/beautiful-react-hooks/#/useGeolocation
- Click "Allow" when location permission is requested.
- 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
).