You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since StrictMode runs the useEffect multiple times the listener is removed but not added again. And the reason we add the listener in this strange way, is that the useEffect is called for the map before it has a target element. Maybe we should do this another way, but currently I don't really know how. The target element is attached here at the moment:
Activity
easbar commentedon Oct 7, 2022
I think the reason the context menu does not open in strict mode is that the context menu listener is removed here:
graphhopper-maps/src/layers/ContextMenu.tsx
Line 55 in d376677
but it is only added via the
map.once('target:change')callback here:graphhopper-maps/src/layers/ContextMenu.tsx
Line 39 in d376677
Since StrictMode runs the useEffect multiple times the listener is removed but not added again. And the reason we add the listener in this strange way, is that the useEffect is called for the
mapbefore it has a target element. Maybe we should do this another way, but currently I don't really know how. The target element is attached here at the moment:graphhopper-maps/src/map/MapComponent.tsx
Line 14 in d376677
[-]Our app does not work in React StrictMode[/-][+]React StrictMode does not work[/+]