You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I removed my mapboxgl.accessToken.
The error occurs after the setTimeout function removes a layer.
Expected Behavior
setFeatureState works as intended.
Actual Behavior
setFeatureState throws the following error:
Uncaught TypeError: Cannot read property 'queryRadius' of undefined
at Ou.setFeatureState (tile.js:464)
at Vu.coalesceChanges (source_state.js:154)
at i.prepare (source_cache.js:170)
at ao.render (painter.js:340)
at r._render (map.js:1753)
at map.js:1837
Reacted by verbeeckjan, Tom Manderson, Andre Piantino and Andrew Harvey
@econ24 Thank you for reporting this issue. I am not able to reproduce the bug in the jsfiddle. It looks like the style used in the demo is private and cannot be accessed by other access tokens.
Could you provide a demo with a public style or one that uses a mapbox style or other simplified style where this issue can be reproduced.
I'm facing this issue as well, under the same conditions of @econ24.
Mapbox GL version I'm using is v0.54.0 but I've tried also with v1.6.0 which presents the same behavour...
Did a little investigation to understand what is causing this issue.
When a layer is removed, it is marked for removal and then processed on the next render by updating the grouping of layers in the works by these two chunks
The update layer index is not re-applied to the tiles though, so existing buckets on the main thread continue to hang on to removed layer ids and are being processed unneccesarily at:
The shortcut to fix this would be to add a null guard on painter.style.getLayer(id) before further processing for that layer id. But this does not solve the root cause, which is that tiles and buckets on the main thread have not been notified of removed layers. This may also be true of updated layers, but I have not confirmed that as of yet.
Activity
asheemmamoowala commentedon Aug 14, 2019
@econ24 Thank you for reporting this issue. I am not able to reproduce the bug in the jsfiddle. It looks like the style used in the demo is private and cannot be accessed by other access tokens.
Could you provide a demo with a public style or one that uses a mapbox style or other simplified style where this issue can be reproduced.
econ24 commentedon Aug 14, 2019
I updated the fiddle with a public style. I don't believe the mapbox account I am using is an enterprise account so the tileset should be public.
verbeeckjan commentedon Sep 18, 2019
I experience this bug too. It is very annoying when switching between layers by adding and removing them.
cammanderson commentedon Oct 2, 2019
We are experiencing the same issue. Appears to be happening through switching layers and use of feature state.
lpmcampos commentedon Dec 27, 2019
I'm facing this issue as well, under the same conditions of @econ24.
Mapbox GL version I'm using is v0.54.0 but I've tried also with v1.6.0 which presents the same behavour...
asheemmamoowala commentedon Jan 3, 2020
Did a little investigation to understand what is causing this issue.
When a layer is removed, it is marked for removal and then processed on the next render by updating the grouping of layers in the works by these two chunks
mapbox-gl-js/src/style/style.js
Lines 375 to 381 in 4f0ab92
mapbox-gl-js/src/source/worker.js
Lines 88 to 91 in 4f0ab92
The update layer index is not re-applied to the tiles though, so existing buckets on the main thread continue to hang on to removed layer ids and are being processed unneccesarily at:
mapbox-gl-js/src/source/tile.js
Lines 394 to 397 in 4f0ab92
The shortcut to fix this would be to add a
nullguard onpainter.style.getLayer(id)before further processing for that layer id. But this does not solve the root cause, which is that tiles and buckets on the main thread have not been notified of removed layers. This may also be true of updated layers, but I have not confirmed that as of yet.