deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

Cannot read properties of null (reading 'isVisible') [Bug]

Open SadikMoazzem opened this issue 3 years ago • 6 comments

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); }

Code Loc

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

Logs

No response

SadikMoazzem avatar Jan 24 '22 09:01 SadikMoazzem

We cannot reproduce the issue from your description. Please create a Codepen/Code Sandbox.

Pessimistress avatar Jan 25 '22 03:01 Pessimistress

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.

grahambates-sp avatar Jan 25 '22 16:01 grahambates-sp

@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?

padawannn avatar Jan 25 '22 17:01 padawannn

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

ibgreen avatar Jan 25 '22 18:01 ibgreen

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.

mfitzer avatar Jul 22 '22 21:07 mfitzer

It seems to be fixed by changing my minZoom to 2 instead of 1.

mfitzer avatar Jul 22 '22 21:07 mfitzer