-
Notifications
You must be signed in to change notification settings - Fork 24
Geolocation error is not reset after success #55
Copy link
Copy link
Open
Description
Describe the bug
The Geolocation error is still being returned from both useCurrentPosition and useWatchPosition hooks, even that the position has been read.
To Reproduce
- Disable location permission
- Use any of the Geolocation hooks
- It returns an object
{ currentPosition: undefined, error: Error } - Enable location permission
- Use any of the Geolocation hooks
- It reruns and object
{ currentPosition: GeolocationPosition, error: Error }
Expected behavior
Hooks should not return error when it does not happen
Screenshots
Desktop (please complete the following information):
- OS: Windows
- Browser Chrome
- Version 126.0.6478.127
Smartphone (please complete the following information):
Not tested
Additional context
Hooks should reset the error state on success:
const id = await Geolocation.watchPosition(options || {}, (pos: Position | null, err) => {
- if (err) {
- setError(err);
- }
+ setError(err);
if (pos) {
setCurrentPosition(pos);
}
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels