-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Description
When in react strict mode the widget when added with react element, appear multiple time, and are re-added every time you interact with the map without being deleted so you can have tons of the same widget added :
also when looking at the code of useWidget :
| if (index && index !== -1) { |
should be to not confuse a widget at index 0 and an undefined
if (index !== undefined && index !== -1) {but it doesn't solve the problem
Flavors
- Script tag
- React
- Python/Jupyter notebook
- MapboxOverlay
- GoogleMapsOverlay
- CARTO
- ArcGIS
Expected Behavior
widget should appear a single time per react component
Steps to Reproduce
<React.StrictMode>
<DeckGL
style={{ position: 'absolute', top: '0', left: '0' }}
width="100%"
height={mapHeight}
layers={layers}
controller
initialViewState={INITIAL_VIEW_STATE}
onViewStateChange={(vs) => setViewState(vs.viewState)}
>
<ReactMapGl mapStyle={mapStyle} />
<FullscreenWidget />
<ZoomWidget />
</DeckGL>
</React.StrictMode>
Environment
- Framework version: 9.2
- Browser: chrome 141
- OS: Linux
Logs
No response
Reactions are currently unavailable