deck.gl
deck.gl copied to clipboard
Cannot read properties of null (reading 'isVisible') [Bug]
Description
Tooltip throws error in edge cases o clear way to reproduce. After look in codebase it seems that the "this.tooltip" is not there
// If view state has changed, clear tooltip if (this.tooltip.isVisible && this.viewManager.needsRedraw()) { this.tooltip.setTooltip(null); }
Flavors
- [X] React
- [ ] Python/Jupyter notebook
- [ ] MapboxLayer
- [ ] GoogleMapsOverlay
- [ ] CartoLayer
- [X] DeckLayer/DeckRenderer for ArcGIS
Expected Behavior
Should not make an error
Steps to Reproduce
` <DeckGL viewState={viewport} layers={deckGlLayers} ContextProvider={MapContext.Provider} onViewStateChange={({ viewState }) =>{ mapControl.updateViewPort({ ...viewState, }); }} controller={{inertia: true}} onLoad={() => updateMapState(true)} onError={() => {}} getCursor={({isDragging}) => isDragging ? 'grabbing' : 'default'} onClick={(e) => mapControl.clickHandler(e)} getTooltip={(e) => { if (!e.layer) return null;
// console.log(e.layer)
if (!e.object) {
return null;
}
// Sensor markers
if (e.object.isMarker) {
return e.object.name;
}
return null;
}}
>
`
Environment
- Framework version:[email protected]
- Browser:97.0.4692.71
- OS: OS 12.1
Logs
No response
We cannot reproduce the issue from your description. Please create a Codepen/Code Sandbox.
I have also experienced this. I think it might be to do with deck.gl parent window resizing, but can't say for sure, it seems to have stopped for me recently.
@Pessimistress I think that we have the same problem but it's difficult to reproduce. After some research, I've seen some code in luma that has changed since the 8.5.10 luma version (we're currently using the 8.5.10 version) https://github.com/visgl/luma.gl/blob/v8.5.10/modules/engine/src/lib/animation-loop.js#L140 https://github.com/visgl/luma.gl/blob/master/modules/engine/src/lib/animation-loop.ts#L143
I don't know if the problem comes from here but sometimes after this finalize is executed, _onRenderFrame
is executed again and this.tooltip
is null. The execution of _onRenderFrame
comes from the animationLoop, right?
For luma.gll, better look at the 8.5-release branch (master is being heavily refactored for 9.0 release).
- https://github.com/visgl/luma.gl/blob/8.5-release/modules/engine/src/lib/animation-loop.js
Are there any updates on this issue? I'm experiencing this error when the window gets to be a big enough size and I try zooming all the way out.
It seems to be fixed by changing my minZoom to 2 instead of 1.