Fix: Kabelstrecken-Checkbox überschreibt Nutzeraktion nach Initialisierung nicht mehr
- Nutzeraktion (Deaktivieren der Kabelstrecken) wird jetzt durch Initialisierung nicht mehr überschrieben - Initialisierung prüft, ob der Nutzer die Checkbox bereits betätigt hat - Verhindert, dass Kabelstrecken nach dem Laden unerwartet
This commit is contained in:
@@ -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.344
|
||||
NEXT_PUBLIC_APP_VERSION=1.1.345
|
||||
|
||||
@@ -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.344
|
||||
NEXT_PUBLIC_APP_VERSION=1.1.345
|
||||
|
||||
@@ -152,6 +152,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const [map, setMap] = useState(null); // Zustand der Karteninstanz
|
||||
const [oms, setOms] = useState(null); // State für OMS-Instanz
|
||||
|
||||
// Flag, ob Nutzer die Polyline-Checkbox manuell betätigt hat
|
||||
const userToggledPolyline = useRef(false);
|
||||
|
||||
//-----userRights----------------
|
||||
const isRightsLoaded = useSelector(
|
||||
state => state.gisUserRightsFromWebservice.status === "succeeded"
|
||||
@@ -274,13 +277,16 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
if (storedMapLayersVisibility) {
|
||||
try {
|
||||
const parsedVisibility = JSON.parse(storedMapLayersVisibility);
|
||||
Object.keys(parsedVisibility).forEach(key => {
|
||||
dispatch(setLayerVisibility({ layer: key, visibility: parsedVisibility[key] }));
|
||||
});
|
||||
console.log(
|
||||
`🔄 mapLayersVisibility für Map ${mapId}/User ${userId} geladen:`,
|
||||
parsedVisibility
|
||||
);
|
||||
// Nur initial setzen, wenn Nutzer noch nicht manuell eingegriffen hat
|
||||
if (!userToggledPolyline.current) {
|
||||
Object.keys(parsedVisibility).forEach(key => {
|
||||
dispatch(setLayerVisibility({ layer: key, visibility: parsedVisibility[key] }));
|
||||
});
|
||||
console.log(
|
||||
`🔄 mapLayersVisibility für Map ${mapId}/User ${userId} geladen:`,
|
||||
parsedVisibility
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("❌ Fehler beim Laden von mapLayersVisibility:", error);
|
||||
}
|
||||
@@ -290,10 +296,20 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
);
|
||||
}
|
||||
// Redux Polyline Sichtbarkeit initialisieren (map/user spezifisch)
|
||||
dispatch(initializePolylineFromLocalStorageThunk());
|
||||
if (!userToggledPolyline.current) {
|
||||
dispatch(initializePolylineFromLocalStorageThunk());
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [dispatch, polylineVisible, map]);
|
||||
// Callback für Checkbox-Umschaltung (Kabelstrecken)
|
||||
const handlePolylineCheckboxChange = useCallback(
|
||||
checked => {
|
||||
userToggledPolyline.current = true;
|
||||
dispatch(setPolylineVisible(checked));
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
useEffect(() => {
|
||||
if (linesData && Array.isArray(linesData)) {
|
||||
const transformed = linesData.map(item => ({
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "nodemap",
|
||||
"version": "1.1.344",
|
||||
"version": "1.1.345",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nodemap",
|
||||
"version": "1.1.344",
|
||||
"version": "1.1.345",
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.13.3",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nodemap",
|
||||
"version": "1.1.344",
|
||||
"version": "1.1.345",
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.13.3",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
|
||||
Reference in New Issue
Block a user