Closed AdamRatcliffe-TomTom closed 1 year ago
I think i get the same error when calling map.jumpto
have you found a solution?
@YonatanHanan unfortunately I have not.
So using the documentation https://deck.gl/docs/api-reference/mapbox/mapbox-overlay#using-with-react-map-gl did not work for me when trying to jumpto
but when I added the MapboxOverlay
as a control manually it did work.
Could that mean I have a different problem?
@YonatanHanan the problem occurs when the MapboxOverlay
is added to the map and at some later time finalized before the end of the map lifetime, either through explicitly calling finalize
on the control or through removing the control from the map. If that's not your situation you may have a different problem.
Calling overlay.finalize()
doesn't remove the map, so the map's events will still be registered. Calling map.remove()
will clean up all event bindings, and deck will also be finalized.
In your use case will you be adding and removing the deck overlay multiple times onto one map instance?
@chrisgervang, if you're asking about my case, the overlay is removed in response to a state change but not added back to the map again.
Do you remove the overlay manually by either calling overlay.finalize()
or map.removeControl(overlay)
, or is there another mechanism for removing it?
I'm using it in React and call map.removeControl(overlay)
when the component is unmounted.
Fix landed in v8.8.27
Description
In deck-utils
getDeckInstance
amove
listener is added but whenfinalize
is called on the overlay the listener is not removed. In my use case the overlay may be removed before the end of the map lifetime, after the overlay is removed moving the map will result in an error being thrown inDeck.setProps
:Flavors
Expected Behavior
Map
move
listener is removed when Deck instance is finalized.Steps to Reproduce
Add a
MapboxOverlay
to the Mapbox GL map. Callfinalize
on the overlay instance. Move the map to trigger the error.Environment
Logs
No response