Fix: Polyline-Layer-Visibility reagiert jetzt zuverlässig auf Redux-State

- setupPolylines wird im useEffect asynchron aufgerufen
- Marker und Polylinien werden erst nach Abschluss der async-Operation gesetzt
- Sichtbarkeit der Kabelstrecken (Kabel-Layer) wird korrekt auf der Karte
This commit is contained in:
ISA
2025-08-20 15:52:56 +02:00
parent 44b29469b9
commit c8a14ee873
5 changed files with 63 additions and 60 deletions

View File

@@ -24,4 +24,4 @@ NEXT_PUBLIC_USE_MOCKS=true
# z.B. http://10.10.0.13/xyz/index.aspx -> basePath in config.json auf /xyz setzen # z.B. http://10.10.0.13/xyz/index.aspx -> basePath in config.json auf /xyz setzen
# basePath wird jetzt in public/config.json gepflegt # basePath wird jetzt in public/config.json gepflegt
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.330 NEXT_PUBLIC_APP_VERSION=1.1.331

View File

@@ -25,4 +25,4 @@ NEXT_PUBLIC_USE_MOCKS=false
# basePath wird jetzt in public/config.json gepflegt # basePath wird jetzt in public/config.json gepflegt
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.330 NEXT_PUBLIC_APP_VERSION=1.1.331

View File

@@ -380,9 +380,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
}); });
cleanupPolylinesForMemory(polylines, map); cleanupPolylinesForMemory(polylines, map);
// Setze neue Marker und Polylinien mit den aktuellen Daten // Setze neue Marker und Polylinien mit den aktuellen Daten (asynchron!)
const updatePolylines = async () => {
if (polylineVisible) { if (polylineVisible) {
const { markers: newMarkers, polylines: newPolylines } = setupPolylines( const { markers: newMarkers, polylines: newPolylines } = await setupPolylines(
map, map,
linePositions, linePositions,
lineColors, lineColors,
@@ -443,6 +444,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
cleanupPolylinesForMemory(polylines, map); cleanupPolylinesForMemory(polylines, map);
setPolylines([]); setPolylines([]);
} }
};
updatePolylines();
}, [ }, [
map, map,
linePositions, linePositions,

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "nodemap", "name": "nodemap",
"version": "1.1.330", "version": "1.1.331",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "nodemap", "name": "nodemap",
"version": "1.1.330", "version": "1.1.331",
"dependencies": { "dependencies": {
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "nodemap", "name": "nodemap",
"version": "1.1.330", "version": "1.1.331",
"dependencies": { "dependencies": {
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",