GeolocateControl returns an error when is out of map max bounds and showUserLocation is false
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: v1.12.0
**browser**: Safari
### Steps to Trigger Behavior
1. Setup a map with some bounds and GeolocateControl (with showUserLocation turned off)
2. Be sure your location is out of the map bounds
3. Try to geolocate yourself. In console you will find an error `[Error] TypeError: undefined is not an object (evaluating 'this._userLocationDotMarker.remove')`, because _onSuccess functions calls _updateMarker when _isOutOfMapMaxBounds, but inside _updateMarker there is a _userLocationDotMarker.remove() call which returns the error, because this call should be wrapped inside a condition `this.options.showUserLocation && this._userLocationDotMarker` like on other places. Because it tries to remove the userLocationDotMarker even though its undefined (when the showUserLocation options is false).
Contributor guide
Research direction
Start in the GeolocateControl _onSuccess and _updateMarker paths described in the report, focusing on the out-of-bounds case when showUserLocation is false. Reproduce the Safari console error and verify that geolocation completes without attempting to remove an undefined user-location marker.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100