diff --git a/components/MapComponent.js b/components/MapComponent.js index 9eb244cb7..8af733533 100644 --- a/components/MapComponent.js +++ b/components/MapComponent.js @@ -403,7 +403,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => { //-----Kontextmenu----ende------------ // Ensure this function is only called when map is initialized and available const showAddStationPopup = (e) => { - if (!initialMap) { + if (!newMap) { return; } @@ -465,7 +465,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => { `; - L.popup().setLatLng(e.latlng).setContent(popupContent).openOn(initialMap); + L.popup().setLatLng(e.latlng).setContent(popupContent).openOn(newMap); // Attach event listener here L.DomEvent.on(popupContent, "submit", handleSubmit);