Open jongshy opened 11 months ago
layer won't show up
Finalized layers cannot be re-added. You will need to construct new layer instances. Pay attention to the console errors.
This is a real issue that has nothing to do with finalized layers. It's caused the layer filter being set to HIDE_ALL_LAYERS
in _onRemove()
:
https://github.com/visgl/deck.gl/blob/7d74676978c8b0f8645678641d9b0bee33a02333/modules/google-maps/src/google-maps-overlay.ts#L190-L192
but there's no reversing it in _onAdd()
:
https://github.com/visgl/deck.gl/blob/7d74676978c8b0f8645678641d9b0bee33a02333/modules/google-maps/src/google-maps-overlay.ts#L147-L150
Adding this._deck.setProps({ layerFilter: null });
to the end of _onAdd()
should resolve the issue.
EDIT: Setting layerFilter
back to null
might not be the correct thing to do, it should be this.props.layerFilter
@felixpalmer Looks like onAdd
should not create a new instance if it already exists?
createDeckInstance
reuses the instance:
https://github.com/visgl/deck.gl/blob/7d74676978c8b0f8645678641d9b0bee33a02333/modules/google-maps/src/utils.ts#L26-L28
so layerFilter
still stays as HIDE_ALL_LAYERS
and no layers get rendered.
EDIT: Thanks for reopening the issue btw :)
Description
setMap(map) -> setMap(null) -> setMap(map) add layer again after delete, can't add
Flavors
Expected Behavior
No response
Steps to Reproduce
const deckOverlay = new GoogleMapsOverlay({ layers: [jsonlayer], });
deckOverlay.setMap(map);
setTimeout(() => { deckOverlay.setMap(null); }, 5000);
setTimeout(() => { deckOverlay.setMap(map); }, 10000);
Environment
Logs
No response