Deck.gl crashes with HeatmapLayer and Google Maps when Canvas resized in Chrome
Description
Using Google Chrome on Linux, Mac OS, and Windows, when there is a HeatmapLayer and the map is resized by dragging the edge of the browser window, deck.gl will emit warnings and sometimes crash.
Repro Steps
- Use deck.gl with Google maps with a HeatmapLayer.
- Resize the parent element of the google map or the browser window itself.
- Keep resizing wildly, as it only happens sometimes.
- Setting the map element or map's parent element's CSS to
display: noneand back to a different value increases the likelihood of the bug happening. - Often times only the warning will be output and the crash will not occur.
Setting visible = false on the heatmap makes no difference. The data (or lack thereof) provided to the layer does not seem to impact the ability to reproduce this bug.
To help make the crash happen, I made this codepen (WARNING: Flashing Lights / Seizure Warning). Resize the window aggressively while watching the console output. To increase the likelihood of the bug occurring, the map's display CSS property is toggling between 'block' and 'none' every 100ms, causing the map to strobe.
Environment (please complete the following information):
- Framework Version: tested with deck.gl 7.3.9, 8.0.11, and 8.0.12
- Browser Version: Chrome 79, Firefox 72
- OS: Mac, Linux, and Windows 10
Appears to be related to #4186
Logs
7[.WebGL-0x3109aac49100]RENDER WARNING: Render count or primcount is 0.
viewport.js:374 deck: Pixel project matrix not invertible
_initPixelMatrices @ viewport.js:374
Viewport @ viewport.js:46
WebMercatorViewport @ web-mercator-viewport.js:81
_getViewport @ view.js:170
makeViewport @ view.js:96
_rebuildViewports @ view-manager.js:271
_update @ view-manager.js:164
setProps @ view-manager.js:153
setProps @ deck.js:235
_draw @ google-maps-overlay.js:108
Dw.draw @ overlay.js:4
Ew.Ta @ overlay.js:5
Yv @ map.js:37
(anonymous) @ map.js:38
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:423
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:498
ZoneTask.invoke @ zone.js:487
timer @ zone.js:3070
requestAnimationFrame (async)
scheduleTask @ zone.js:3091
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:410
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask @ zone.js:261
scheduleMacroTaskWithCurrentZone @ zone.js:1194
(anonymous) @ zone.js:3106
proto.
... The stacktrace starting with "requestAnimationFrame @ request-animation-frame.js:2" repeats many more times
layer-manager.js:444 deck: error during update of HeatmapLayer({id: 'heat-map-layer'}) TypeError: Cannot read property '0' of null
at Module.transformMat4 (vec4.js:487)
at transformVector (math-utils.js:6)
at pixelsToWorld (web-mercator-utils.js:195)
at WebMercatorViewport.unproject (viewport.js:98)
at HeatmapLayer._updateBounds (heatmap-layer.js:416)
at HeatmapLayer.updateState (heatmap-layer.js:131)
at HeatmapLayer._updateState (layer.js:720)
at HeatmapLayer._update (layer.js:704)
at LayerManager._updateLayer (layer-manager.js:442)
at LayerManager.activateViewport (layer-manager.js:250)
_updateLayer @ layer-manager.js:444
activateViewport @ layer-manager.js:250
(anonymous) @ layers-pass.js:47
_drawLayers @ layers-pass.js:44
render @ layers-pass.js:25
renderLayers @ deck-renderer.js:54
_drawLayers @ deck.js:622
redraw @ deck.js:304
_draw @ google-maps-overlay.js:118
Dw.draw @ overlay.js:4
Ew.Ta @ overlay.js:5
Yv @ map.js:37
(anonymous) @ map.js:38
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:423
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:498
ZoneTask.invoke @ zone.js:487
timer @ zone.js:3070
requestAnimationFrame (async)
scheduleTask @ zone.js:3091
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:410
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask @ zone.js:261
scheduleMacroTaskWithCurrentZone @ zone.js:1194
(anonymous) @ zone.js:3106
proto.
... The stack trace starting with "requestAnimationFrame @ request-animation-frame.js:2" repeats many more times.
zone.js:199 Uncaught TypeError: Cannot read property '0' of null at Module.transformMat4 (vec4.js:487) at transformVector (math-utils.js:6) at pixelsToWorld (web-mercator-utils.js:195) at WebMercatorViewport.unproject (viewport.js:98) at HeatmapLayer._updateBounds (heatmap-layer.js:416) at HeatmapLayer.updateState (heatmap-layer.js:131) at HeatmapLayer._updateState (layer.js:720) at HeatmapLayer._update (layer.js:704) at LayerManager._updateLayer (layer-manager.js:442) at LayerManager._updateSublayersRecursively (layer-manager.js:361)
Pixel project matrix not invertible
Is this is the first error you see in the console? Can you try by setting deck.log.priority=3 in the browser console and copy paste the warning/errors.
Also does this happen if you use a different layer other than HeatmapLayer?
@1chandu
If the data property on the HeatmapLayer is an empty list, the first line of output is the warning [.WebGL-0x2b35b039b100]RENDER WARNING: Render count or primcount is 0., but that does not cause the crash.
I have not been able to reproduce this bug with other layers, but the only other layers I am using are the ScatterplotLayer, GeoJsonLayer, and IconLayer. I have observed that by commenting out the HeatmapLayer, this deck.gl bug cannot be reproduced, so the issue is definitely related to the HeatmapLayer.
loggers.js:59 deck: Updated attributes for 0 instances in my-scatterplot-layer in 4ms
loggers.js:59 deck: Updated attributes for 1 instances in heat-map-layer in 1ms
loggers.js:59 deck: Updated attributes for 1 instances in heat-map-layer-triangle-layer in 0ms
loggers.js:59 deck: Updated attributes for 0 instances in my-icon-layer-1 in 1ms
loggers.js:59 deck: Updated attributes for 0 instances in my-icon-layer-2 in 0ms
loggers.js:59 deck: Updated attributes for 0 instances in my-icon-layer-3 in 1ms
viewport.js:374 deck: Pixel project matrix not invertible
_initPixelMatrices @ viewport.js:374
Viewport @ viewport.js:46
WebMercatorViewport @ web-mercator-viewport.js:81
_getViewport @ view.js:170
makeViewport @ view.js:96
_rebuildViewports @ view-manager.js:271
_update @ view-manager.js:164
setProps @ view-manager.js:153
setProps @ deck.js:235
_draw @ google-maps-overlay.js:108
Dw.draw @ overlay.js:4
Ew.Ta @ overlay.js:5
Yv @ map.js:37
(anonymous) @ map.js:38
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
ZoneTask.invokeTask @ zone.js:513
ZoneTask.invoke @ zone.js:502
timer @ zone.js:3041
requestAnimationFrame (async)
scheduleTask @ zone.js:3062
ZoneDelegate.scheduleTask @ zone.js:417
Zone.scheduleTask @ zone.js:241
Zone.scheduleMacroTask @ zone.js:264
scheduleMacroTaskWithCurrentZone @ zone.js:1192
(anonymous) @ zone.js:3075
proto.<computed> @ zone.js:1510
_.dn @ common.js:26
cw @ map.js:37
(anonymous) @ map.js:40
RN @ map.js:85
(anonymous) @ map.js:86
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
ZoneTask.invokeTask @ zone.js:513
invokeTask @ zone.js:1671
globalZoneAwareCallback @ zone.js:1697
load (async)
customScheduleGlobal @ zone.js:1810
ZoneDelegate.scheduleTask @ zone.js:417
Zone.scheduleTask @ zone.js:241
Zone.scheduleEventTask @ zone.js:267
(anonymous) @ zone.js:1984
_.N.addDomListener @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:208
ww.h @ map.js:86
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:152
ZoneDelegate.invoke @ zone.js:396
Zone.run @ zone.js:153
(anonymous) @ zone.js:894
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
drainMicroTaskQueue @ zone.js:611
Promise.then (async)
scheduleMicroTask @ zone.js:594
ZoneDelegate.scheduleTask @ zone.js:420
Zone.scheduleTask @ zone.js:241
Zone.scheduleMicroTask @ zone.js:261
scheduleResolveOrReject @ zone.js:884
resolvePromise @ zone.js:830
(anonymous) @ zone.js:750
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
mf @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
hf.pc @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ common.js:1
layer-manager.js:444 deck: error during update of HeatmapLayer({id: 'heat-map-layer'}) TypeError: Cannot read property '0' of null
at Module.transformMat4 (vec4.js:487)
at transformVector (math-utils.js:6)
at pixelsToWorld (web-mercator-utils.js:195)
at WebMercatorViewport.unproject (viewport.js:98)
at HeatmapLayer._updateBounds (heatmap-layer.js:416)
at HeatmapLayer.updateState (heatmap-layer.js:131)
at HeatmapLayer._updateState (layer.js:720)
at HeatmapLayer._update (layer.js:704)
at LayerManager._updateLayer (layer-manager.js:442)
at LayerManager.activateViewport (layer-manager.js:250)
_updateLayer @ layer-manager.js:444
activateViewport @ layer-manager.js:250
(anonymous) @ layers-pass.js:47
_drawLayers @ layers-pass.js:44
render @ layers-pass.js:25
renderLayers @ deck-renderer.js:54
_drawLayers @ deck.js:622
redraw @ deck.js:304
_draw @ google-maps-overlay.js:118
Dw.draw @ overlay.js:4
Ew.Ta @ overlay.js:5
Yv @ map.js:37
(anonymous) @ map.js:38
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
ZoneTask.invokeTask @ zone.js:513
ZoneTask.invoke @ zone.js:502
timer @ zone.js:3041
requestAnimationFrame (async)
scheduleTask @ zone.js:3062
ZoneDelegate.scheduleTask @ zone.js:417
Zone.scheduleTask @ zone.js:241
Zone.scheduleMacroTask @ zone.js:264
scheduleMacroTaskWithCurrentZone @ zone.js:1192
(anonymous) @ zone.js:3075
proto.<computed> @ zone.js:1510
_.dn @ common.js:26
cw @ map.js:37
(anonymous) @ map.js:40
RN @ map.js:85
(anonymous) @ map.js:86
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
ZoneTask.invokeTask @ zone.js:513
invokeTask @ zone.js:1671
globalZoneAwareCallback @ zone.js:1697
load (async)
customScheduleGlobal @ zone.js:1810
ZoneDelegate.scheduleTask @ zone.js:417
Zone.scheduleTask @ zone.js:241
Zone.scheduleEventTask @ zone.js:267
(anonymous) @ zone.js:1984
_.N.addDomListener @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:208
ww.h @ map.js:86
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:152
ZoneDelegate.invoke @ zone.js:396
Zone.run @ zone.js:153
(anonymous) @ zone.js:894
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
drainMicroTaskQueue @ zone.js:611
Promise.then (async)
scheduleMicroTask @ zone.js:594
ZoneDelegate.scheduleTask @ zone.js:420
Zone.scheduleTask @ zone.js:241
Zone.scheduleMicroTask @ zone.js:261
scheduleResolveOrReject @ zone.js:884
resolvePromise @ zone.js:830
(anonymous) @ zone.js:750
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
mf @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
hf.pc @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ common.js:1
loggers.js:59 deck: Updated attributes for 1 instances in heat-map-layer-triangle-layer in 0ms
zone.js:202 Uncaught TypeError: Cannot read property '0' of null
at Module.transformMat4 (vec4.js:487)
at transformVector (math-utils.js:6)
at pixelsToWorld (web-mercator-utils.js:195)
at WebMercatorViewport.unproject (viewport.js:98)
at HeatmapLayer._updateBounds (heatmap-layer.js:416)
at HeatmapLayer.updateState (heatmap-layer.js:131)
at HeatmapLayer._updateState (layer.js:720)
at HeatmapLayer._update (layer.js:704)
at LayerManager._updateLayer (layer-manager.js:442)
at LayerManager._updateSublayersRecursively (layer-manager.js:361)
transformMat4 @ vec4.js:487
transformVector @ math-utils.js:6
pixelsToWorld @ web-mercator-utils.js:195
unproject @ viewport.js:98
_updateBounds @ heatmap-layer.js:416
updateState @ heatmap-layer.js:131
_updateState @ layer.js:720
_update @ layer.js:704
_updateLayer @ layer-manager.js:442
_updateSublayersRecursively @ layer-manager.js:361
_updateLayers @ layer-manager.js:305
setLayers @ layer-manager.js:213
updateLayers @ layer-manager.js:225
_onRenderFrame @ deck.js:663
onRender @ animation-loop.js:283
_renderFrame @ animation-loop.js:375
redraw @ animation-loop.js:175
renderFrame @ animation-loop.js:315
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
ZoneTask.invokeTask @ zone.js:513
ZoneTask.invoke @ zone.js:502
timer @ zone.js:3041
requestAnimationFrame (async)
scheduleTask @ zone.js:3062
ZoneDelegate.scheduleTask @ zone.js:417
Zone.scheduleTask @ zone.js:241
Zone.scheduleMacroTask @ zone.js:264
scheduleMacroTaskWithCurrentZone @ zone.js:1192
(anonymous) @ zone.js:3075
proto.<computed> @ zone.js:1510
requestAnimationFrame @ request-animation-frame.js:2
_requestAnimationFrame @ animation-loop.js:362
renderFrame @ animation-loop.js:317
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
ZoneTask.invokeTask @ zone.js:513
ZoneTask.invoke @ zone.js:502
timer @ zone.js:3041
requestAnimationFrame (async)
scheduleTask @ zone.js:3062
ZoneDelegate.scheduleTask @ zone.js:417
Zone.scheduleTask @ zone.js:241
Zone.scheduleMacroTask @ zone.js:264
scheduleMacroTaskWithCurrentZone @ zone.js:1192
(anonymous) @ zone.js:3075
proto.<computed> @ zone.js:1510
requestAnimationFrame @ request-animation-frame.js:2
_requestAnimationFrame @ animation-loop.js:362
_startLoop @ animation-loop.js:321
(anonymous) @ animation-loop.js:159
ZoneDelegate.invoke @ zone.js:396
Zone.run @ zone.js:153
(anonymous) @ zone.js:894
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
drainMicroTaskQueue @ zone.js:611
ZoneTask.invokeTask @ zone.js:517
ZoneTask.invoke @ zone.js:502
timer @ zone.js:3041
requestAnimationFrame (async)
scheduleTask @ zone.js:3062
ZoneDelegate.scheduleTask @ zone.js:417
Zone.scheduleTask @ zone.js:241
Zone.scheduleMacroTask @ zone.js:264
scheduleMacroTaskWithCurrentZone @ zone.js:1192
(anonymous) @ zone.js:3075
proto.<computed> @ zone.js:1510
_.dn @ common.js:26
cw @ map.js:37
(anonymous) @ map.js:40
Wv.ua @ map.js:67
_.t.ua @ map.js:72
ww.h @ map.js:80
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:152
ZoneDelegate.invoke @ zone.js:396
Zone.run @ zone.js:153
(anonymous) @ zone.js:894
ZoneDelegate.invokeTask @ zone.js:431
Zone.runTask @ zone.js:198
drainMicroTaskQueue @ zone.js:611
Promise.then (async)
scheduleMicroTask @ zone.js:594
ZoneDelegate.scheduleTask @ zone.js:420
Zone.scheduleTask @ zone.js:241
Zone.scheduleMicroTask @ zone.js:261
scheduleResolveOrReject @ zone.js:884
resolvePromise @ zone.js:830
(anonymous) @ zone.js:750
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
(anonymous) @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
mf @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:107
hf.pc @ js?v=quarterly&callback=agmLazyMapsAPILoader&key=<REDACTED>&channel=<REDACTED>&libraries=places,visualization,geometry®ion=US&language=en:224
(anonymous) @ common.js:1
loggers.js:59 deck: Updated attributes for 7 instances in my-scatterplot-layer in 1ms
loggers.js:59 deck: Updated attributes for 1 instances in heat-map-layer in 0ms
loggers.js:59 deck: Updated attributes for 7 instances in my-icon-layer-1 in 2ms
loggers.js:59 deck: Updated attributes for 0 instances in my-icon-layer-2 in 0ms
loggers.js:59 deck: Updated attributes for 1 instances in heat-map-layer in 1ms
<REDACTED>-lib.js:13963 TypeError: Cannot read property '0' of null
at Module.transformMat4 (vec4.js:487)
at transformVector (math-utils.js:6)
at pixelsToWorld (web-mercator-utils.js:195)
at WebMercatorViewport.unproject (viewport.js:98)
at HeatmapLayer._updateBounds (heatmap-layer.js:416)
at HeatmapLayer.updateState (heatmap-layer.js:131)
at HeatmapLayer._updateState (layer.js:720)
at HeatmapLayer._update (layer.js:704)
at LayerManager._updateLayer (layer-manager.js:442)
at LayerManager._updateSublayersRecursively (layer-manager.js:361)
There seems to be two issues here. One issue is that the heatmap layer does not like the data property to be an empty array, even when the layer's visible property is set to false.
The other issue seems to be that the heatmap layer tries to initialize before the google map emits its first idle event (https://developers.google.com/maps/documentation/javascript/reference/map#Map.idle).
I've just discovered that as long as I wait for the google map to emit the first idle event and THEN initialize deck.gl, then the viewport.js:374 deck: Pixel project matrix not invertible error and subsequent crash no longer occurs.
If I make the existence of the HeatmapLayer dependent on the data property having length > 0, then I no longer get the [.WebGL-0x2b35b1c1a700]RENDER WARNING: Render count or primcount is 0. warning and sometimes this crash with this error I posted in my comment earlier today:
deck: error while initializing HeatmapLayer({id: 'heat-map-layer'})
TypeError: Cannot read property '0' of null
at Module.transformMat4 (vec4.js:487)
at transformVector (math-utils.js:6)
at pixelsToWorld (web-mercator-utils.js:195)
at WebMercatorViewport.unproject (viewport.js:98)
at HeatmapLayer._updateBounds (heatmap-layer.js:416)
at HeatmapLayer.updateState (heatmap-layer.js:131)
at HeatmapLayer._updateState (layer.js:720)
at HeatmapLayer._initialize (layer.js:695)
at LayerManager._initializeLayer (layer-manager.js:417)
at LayerManager._updateSublayersRecursively (layer-manager.js:355)
Using both changes in tandem, I am no longer getting any reproducible crashes.
So the takeaways:
- The HeatmapLayer should be able to handle the case when
datais an empty array (and probably any case where it's falsy), because it can currently crash. - Deck.gl should probably not initialize with the Google map instance until the map has fired its first
idleevent or else crashes can occur.
I suspect the offending lines are here:
https://github.com/uber/deck.gl/blob/244d79200dd1abcca6b93ad0c1ef6fa58ae36c16/modules/google-maps/src/utils.js#L88-L89
If width and height comes back as zeros then zoom will be NaN, resulting in the matrix inversion error.
Can you try [email protected]?
@Pessimistress I updated my demo to pull in https://unpkg.com/[email protected]/dist.min.js and am still able to get the following console errors when I resize the window aggressively. Is there a non-minified standalone bundled version of deck.gl that I could pull in for a better stack traces?
iframeConsoleRunner-dc0d50e60903d6825042d06159a8d5ac69a6c0e9bcef91e3380b17617061ce0f.js:1 deck: error during update of HeatmapLayer({id: 'heat-map-layer'}) TypeError: Cannot read property '0' of null
at Object.p (dist.min.js:1)
at h (dist.min.js:1)
at L (dist.min.js:1)
at t.value (dist.min.js:1)
at t.value (dist.min.js:11)
at t.value (dist.min.js:11)
at t.value (dist.min.js:1)
at t.value (dist.min.js:1)
at e.value (dist.min.js:6)
at e.value (dist.min.js:6)
(anonymous) @ iframeConsoleRunner-dc0d50e60903d6825042d06159a8d5ac69a6c0e9bcef91e3380b17617061ce0f.js:1
value @ dist.min.js:6
value @ dist.min.js:6
value @ dist.min.js:6
value @ dist.min.js:1
value @ dist.min.js:1
value @ dist.min.js:6
value @ dist.min.js:6
value @ dist.min.js:6
value @ dist.min.js:6
value @ dist.min.js:6
value @ dist.min.js:6
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
requestAnimationFrame (async)
value @ dist.min.js:6
t @ dist.min.js:6
dist.min.js:1 Uncaught TypeError: Cannot read property '0' of null
at Object.p (dist.min.js:1)
at h (dist.min.js:1)
at L (dist.min.js:1)
at t.value (dist.min.js:1)
at t.get (dist.min.js:6)
at t.value (dist.min.js:1)
at t.value (dist.min.js:1)
at e.value (dist.min.js:6)
at e.value (dist.min.js:6)
at e.value (dist.min.js:6)
Is there a non-minified standalone bundled version of deck.gl that I could pull in for a better stack traces?
https://unpkg.com/[email protected]/dist/dist.dev.js
@Pessimistress with the non-minified stack trace:
dist.dev.js:75374 deck: error during update of HeatmapLayer({id: 'heat-map-layer'}) TypeError: Cannot read property '0' of null
at Module.transformMat4 (dist.dev.js:51791)
at transformVector (dist.dev.js:44344)
at pixelsToWorld (dist.dev.js:44830)
at WebMercatorViewport.unproject (dist.dev.js:82440)
at HeatmapLayer._updateBounds (dist.dev.js:64071)
at HeatmapLayer.updateState (dist.dev.js:63817)
at HeatmapLayer._updateState (dist.dev.js:76142)
at HeatmapLayer._update (dist.dev.js:76125)
at LayerManager._updateLayer (dist.dev.js:75493)
at LayerManager.activateViewport (dist.dev.js:75363)
_handleError @ dist.dev.js:75374
_updateLayer @ dist.dev.js:75495
activateViewport @ dist.dev.js:75363
_drawLayers @ dist.dev.js:78445
render @ dist.dev.js:78424
renderLayers @ dist.dev.js:73863
_drawLayers @ dist.dev.js:74604
redraw @ dist.dev.js:74294
_onRenderFrame @ dist.dev.js:74656
onRender @ dist.dev.js:19778
_renderFrame @ dist.dev.js:19870
redraw @ dist.dev.js:19670
renderFrame @ dist.dev.js:19810
requestAnimationFrame (async)
requestAnimationFrame @ dist.dev.js:37557
_requestAnimationFrame @ dist.dev.js:19857
_startLoop @ dist.dev.js:19816
(anonymous) @ dist.dev.js:19654
Promise.then (async)
start @ dist.dev.js:19649
Deck @ dist.dev.js:74167
createDeckInstance @ dist.dev.js:86585
_onAdd @ dist.dev.js:86492
Dw.draw @ overlay.js:4
Ew.Ta @ overlay.js:5
Yv @ map.js:37
(anonymous) @ map.js:38
requestAnimationFrame (async)
_.dn @ common.js:26
cw @ map.js:37
(anonymous) @ map.js:40
Wv.ua @ map.js:67
_.t.ua @ map.js:72
ww.h @ map.js:80
(anonymous) @ js?v=3&libraries=places,visualization,geometry®ion=US&language=en:149
Promise.then (async)
ei @ js?v=3&libraries=places,visualization,geometry®ion=US&language=en:149
(anonymous) @ pen.js:5
dist.dev.js:51791 Uncaught TypeError: Cannot read property '0' of null
at Module.transformMat4 (dist.dev.js:51791)
at transformVector (dist.dev.js:44344)
at pixelsToWorld (dist.dev.js:44830)
at WebMercatorViewport.unproject (dist.dev.js:82440)
at WebMercatorViewport.get subViewports [as subViewports] (dist.dev.js:82874)
at DrawLayersPass._drawLayers (dist.dev.js:78450)
at DrawLayersPass.render (dist.dev.js:78424)
at DeckRenderer.renderLayers (dist.dev.js:73863)
at Deck._drawLayers (dist.dev.js:74604)
at Deck.redraw (dist.dev.js:74294)
When the user's aggressively resizing, occasionally google map's getBounds() returns a box of size 0 (northeast and southwest are the same points). This breaks our zoom calculation. @donmccurdy this looks like a bug?
I will add a safeguard against this.
8.1.0-alpha.4 published with the above fix.
@Pessimistress that would sound like a bug to me, but I can't reproduce it here. From your description, I tried this...
function animate () {
requestAnimationFrame(animate);
var bounds = map.getBounds();
var neLat = bounds.getNorthEast().lat();
var swLat = bounds.getSouthWest().lat();
if (Math.abs(neLat - swLat) < 0.1) {
console.log('collapse!', bounds);
}
}
requestAnimationFrame(animate);
... without deckgl involved, just plain Maps API. Resizing as aggressively as I could manage (😅) in Chrome on macOS, I couldn't get a printout.