diff --git a/.env.development b/.env.development
index 7fe032bfe..c2460c680 100644
--- a/.env.development
+++ b/.env.development
@@ -23,4 +23,4 @@ NEXT_PUBLIC_USE_MOCKS=true
# 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
# App-Versionsnummer
-NEXT_PUBLIC_APP_VERSION=1.1.345
+NEXT_PUBLIC_APP_VERSION=1.1.346
diff --git a/.env.production b/.env.production
index 2018568ec..fe9aa556b 100644
--- a/.env.production
+++ b/.env.production
@@ -24,4 +24,4 @@ NEXT_PUBLIC_USE_MOCKS=false
# basePath wird jetzt in public/config.json gepflegt
# App-Versionsnummer
-NEXT_PUBLIC_APP_VERSION=1.1.345
+NEXT_PUBLIC_APP_VERSION=1.1.346
diff --git a/components/mainComponent/MapComponent.js b/components/mainComponent/MapComponent.js
index 30349cd1d..dd120e166 100644
--- a/components/mainComponent/MapComponent.js
+++ b/components/mainComponent/MapComponent.js
@@ -153,7 +153,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const [oms, setOms] = useState(null); // State für OMS-Instanz
// Flag, ob Nutzer die Polyline-Checkbox manuell betätigt hat
- const userToggledPolyline = useRef(false);
+ // Nutzer-Flag global auf window, damit auch Redux darauf zugreifen kann
+ if (typeof window !== "undefined" && window.userToggledPolyline === undefined) {
+ window.userToggledPolyline = false;
+ }
//-----userRights----------------
const isRightsLoaded = useSelector(
@@ -305,7 +308,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
// Callback für Checkbox-Umschaltung (Kabelstrecken)
const handlePolylineCheckboxChange = useCallback(
checked => {
- userToggledPolyline.current = true;
+ if (typeof window !== "undefined") {
+ window.userToggledPolyline = true;
+ }
dispatch(setPolylineVisible(checked));
},
[dispatch]
@@ -1031,7 +1036,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
{GisStationsStaticDistrict && GisStationsStaticDistrict.Points?.length > 0 && (
-
+
)}
diff --git a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js
index b7d6bd88f..2304e1b86 100644
--- a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js
+++ b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js
@@ -14,7 +14,7 @@ import { selectMapLayersState, setLayerVisibility } from "@/redux/slices/mapLaye
import { setVisible } from "@/redux/slices/database/pois/poiLayerVisibleSlice";
import { incrementZoomTrigger } from "@/redux/slices/zoomTriggerSlice";
-function MapLayersControlPanel() {
+function MapLayersControlPanel({ handlePolylineCheckboxChange }) {
const [editMode, setEditMode] = useState(false); // Zustand für editMode
const [localStorageLoaded, setLocalStorageLoaded] = useState(false); // Tracking ob localStorage geladen wurde
const kabelstreckenVisible = useSelector(selectPolylineVisible); // Nur noch Redux
@@ -39,36 +39,7 @@ function MapLayersControlPanel() {
)
: false;
- const handlePolylineCheckboxChange = event => {
- const checked = event.target.checked;
- // Debug-Ausgabe
- const params = new URLSearchParams(window.location.search);
- const mapId = params.get("m");
- const userId = params.get("u");
- const polylineKey =
- mapId && userId ? `polylineVisible_m${mapId}_u${userId}` : "polylineVisible";
- console.log(
- "[UI/handlePolylineCheckboxChange] checked:",
- checked,
- "Redux:",
- kabelstreckenVisible,
- "localStorage:",
- localStorage.getItem(polylineKey)
- );
- dispatch(setPolylineVisible(checked));
- // Wenn aktiviert, TALAS aktivieren
- if (checked) {
- const talasKey = "system-1";
- dispatch(setLayerVisibility({ layer: talasKey, visibility: true }));
- // Optional: mapLayersVisibility im localStorage aktualisieren, aber nicht mehr für Sichtbarkeit nutzen
- const mapId = localStorage.getItem("currentMapId");
- const userId = localStorage.getItem("currentUserId");
- const mapStorageKey =
- mapId && userId ? `mapLayersVisibility_m${mapId}_u${userId}` : "mapLayersVisibility";
- const updatedVisibility = { ...mapLayersVisibility, [talasKey]: true };
- localStorage.setItem(mapStorageKey, JSON.stringify(updatedVisibility));
- }
- };
+ // handlePolylineCheckboxChange kommt jetzt als Prop von MapComponent
useEffect(() => {
// LocalStorage Werte beim ersten Laden der Komponente wiederherstellen (nur für POI und mapLayersVisibility, nicht mehr für Kabelstrecken)
@@ -338,8 +309,8 @@ function MapLayersControlPanel() {
handlePolylineCheckboxChange(e.target.checked)}
id="polyline-checkbox"
disabled={!isTalasAllowed || editMode}
/>
diff --git a/package-lock.json b/package-lock.json
index fd425f194..035dae8eb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "nodemap",
- "version": "1.1.345",
+ "version": "1.1.346",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "nodemap",
- "version": "1.1.345",
+ "version": "1.1.346",
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
diff --git a/package.json b/package.json
index e61217408..42e97b4ee 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nodemap",
- "version": "1.1.345",
+ "version": "1.1.346",
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
diff --git a/redux/slices/database/polylines/polylineLayerVisibleSlice.js b/redux/slices/database/polylines/polylineLayerVisibleSlice.js
index d967021c1..937a47d22 100644
--- a/redux/slices/database/polylines/polylineLayerVisibleSlice.js
+++ b/redux/slices/database/polylines/polylineLayerVisibleSlice.js
@@ -5,6 +5,13 @@ import { createSlice } from "@reduxjs/toolkit";
// Thunk to initialize polyline visibility from localStorage using mapId/userId from URL
export const initializePolylineFromLocalStorageThunk = () => dispatch => {
try {
+ // Prüfe globales Nutzer-Flag
+ if (typeof window !== "undefined" && window.userToggledPolyline) {
+ console.log(
+ "[Redux] Initialisierung abgebrochen: Nutzer hat Polyline bereits manuell geändert."
+ );
+ return;
+ }
const params = new URLSearchParams(window.location.search);
const mapId = params.get("m");
const userId = params.get("u");
@@ -60,6 +67,12 @@ const polylineLayerVisibleSlice = createSlice({
},
initializePolylineFromLocalStorage: (state, action) => {
// Diese Action wird nur beim Initialisieren aus localStorage verwendet
+ if (typeof window !== "undefined" && window.userToggledPolyline) {
+ console.log(
+ "[Redux] Initialisierung im Reducer abgebrochen: Nutzer hat Polyline bereits manuell geändert."
+ );
+ return;
+ }
state.visible = action.payload;
state.isInitialized = true;
console.log(