map.on("idle" is not firing in 3.17.0 (worked in 3.16.0)
mapbox-gl-js version
v3.17.0
Browser and version
Chrome 142.0.7444.176
Expected behavior
In v3.16.0, map.on("idle") fired appropriately.
Actual behavior
After upgrading to v3.17.0 (with no other code changes on my part), map.on("idle") never fires. Unfortunately, a simple example as in the link below doesn't demonstrate the issue, so it's some other weird interaction.
Link to the demonstration
https://codepen.io/jaybonomad/pen/pvyQqYZ?editors=1111
Steps to trigger the unexpected behavior
Unfortunately, I can't repro in a simple example.
Other info:
- toolchain: Quasar / Vue / Typescript
- using mapbox-draw
- using custom layer
- not setting
repaint: truein options map.isMoving() == falsemap.isEasing() == falsemap.isZooming() == falsemap.isStyleLoaded() == true
Relevant log output
Thanks for the report! Since we're not able to reproduce this on our end yet, we'd really appreciate if you could either continue trying to get a minimal reproducible test case, or alternatively bisect GL JS source in the repo between v3.16.0 and v3.17.0 (building GL JS at each step) to find the offending commit.
Further investigations:
- verified app otherwise runs normally if
map.on("idle")is internally simulated. - removed custom layer and verified problem still exists.
- verified it's not a
yarn upgradeissue by nukingnode_modules.
Where in mapbox-gl code is the idleevent triggered?
@jaybo in the source, it's here: https://github.com/mapbox/mapbox-gl-js/blob/main/src/ui/map.ts#L4657
If I repeatedly hit a breakpoint on line 4640 of map.ts:
const somethingDirty = this._sourcesDirty || this._styleDirty || this._placementDirty || averageElevationChanged;
all at some point become false, except _styleDirty which is always true.
Bingo!
Some years ago I added setTerrain(null), I think to get around this bug: https://github.com/mapbox/mapbox-gl-js/issues/10927
Now, if I remove the setTerrain(null) the idle event happens.
Pen updated to show the problem: https://codepen.io/jaybonomad/pen/pvyQqYZ?editors=1111