mapbox / mapbox/mapbox-gl-js

bug: map.flyTo with explicit `duration: undefined` throws `TypeError`, subsequent calls to `map.getBounds()` throw many `Error: Invalid LatLng Object`

Open
#13,659 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

### mapbox-gl-js version

v3.21.0

### Browser and version

tested in Chromium Version 145.0.7632.159 (Official Build) (64-bit), and Firefox 140.0 (64-bit)

### Expected behavior

Calling `flyTo` with explicit `duration: undefined` should behave the same as omitting `duration` parameter.

### Actual behavior

Calling `flyTo` with explicit `duration: undefined` causes total breakdown.

### Link to the demonstration

https://output.jsbin.com/yopanudexe

### Steps to trigger the unexpected behavior

this suffices:
```
map.flyTo({ center: [10, 10], zoom: 3, duration: undefined });
map.getBounds();
```

### Relevant log output

```shell
Uncaught TypeError: can't access property 3 of null
j vec3.js:500
fromInvProjectionMatrix primitives.ts:135
_calcMatrices transform.ts:2473
set zoom transform.ts:540
z camera.ts:1729
_renderFrameCallback camera.ts:1837
run task_queue.ts:51
_render map.ts:4510
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
triggerRepaint map.ts:4991
_update map.ts:4439
_requestRenderFrame map.ts:4451
_ease camera.ts:1829
flyTo camera.ts:1767
repro.html:29
fire evented.ts:151
_render map.ts:4598
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
triggerRepaint map.ts:4991
_render map.ts:4679
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
triggerRepaint map.ts:4991
_render map.ts:4679
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
triggerRepaint map.ts:4991
_render map.ts:4679
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
_render map.ts:4691
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
triggerRepaint map.ts:4991
_render map.ts:4679
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
triggerRepaint map.ts:4991
_render map.ts:4679
_frame map.ts:5003
frame browser.ts:39
_triggerFrame map.ts:4997
triggerRepaint map.ts:4991
_update map.ts:4439
Map map.ts:795
fire evented.ts:151
fire evented.ts:168
fire evented.ts:168
_tileLoaded source_cache.ts:319
c vector_tile_source.ts:411
processTask actor.ts:165
receive actor.ts:144
mapbox-gl.js:11:6883

Uncaught Error: Invalid LngLat object: (NaN, NaN)
Ru lng_lat.ts:76
unproject mercator.ts:31
coordinateLocation transform.ts:1721
pointLocation3D transform.ts:1692
unproject map.ts:1575
Xa events.ts:152
mouseover map_event.ts:61
handleEvent handler_manager.ts:360
kl handler_manager.ts:192
Map map.ts:737
repro.html:25
lng_lat.ts:76:19
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided JSBin reproduction and the flyTo entry point in camera.ts; use the stack trace to follow related behavior in transform.ts and map.ts. The fix is complete when duration: undefined behaves like an omitted duration and the subsequent map.getBounds() call does not produce errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.