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
|
# 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.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
|
# basePath wird jetzt in public/config.json gepflegt
|
||||||
|
|
||||||
# App-Versionsnummer
|
# 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 [map, setMap] = useState(null); // Zustand der Karteninstanz
|
||||||
const [oms, setOms] = useState(null); // State für OMS-Instanz
|
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----------------
|
//-----userRights----------------
|
||||||
const isRightsLoaded = useSelector(
|
const isRightsLoaded = useSelector(
|
||||||
state => state.gisUserRightsFromWebservice.status === "succeeded"
|
state => state.gisUserRightsFromWebservice.status === "succeeded"
|
||||||
@@ -274,6 +277,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
if (storedMapLayersVisibility) {
|
if (storedMapLayersVisibility) {
|
||||||
try {
|
try {
|
||||||
const parsedVisibility = JSON.parse(storedMapLayersVisibility);
|
const parsedVisibility = JSON.parse(storedMapLayersVisibility);
|
||||||
|
// Nur initial setzen, wenn Nutzer noch nicht manuell eingegriffen hat
|
||||||
|
if (!userToggledPolyline.current) {
|
||||||
Object.keys(parsedVisibility).forEach(key => {
|
Object.keys(parsedVisibility).forEach(key => {
|
||||||
dispatch(setLayerVisibility({ layer: key, visibility: parsedVisibility[key] }));
|
dispatch(setLayerVisibility({ layer: key, visibility: parsedVisibility[key] }));
|
||||||
});
|
});
|
||||||
@@ -281,6 +286,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
`🔄 mapLayersVisibility für Map ${mapId}/User ${userId} geladen:`,
|
`🔄 mapLayersVisibility für Map ${mapId}/User ${userId} geladen:`,
|
||||||
parsedVisibility
|
parsedVisibility
|
||||||
);
|
);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("❌ Fehler beim Laden von mapLayersVisibility:", 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)
|
// Redux Polyline Sichtbarkeit initialisieren (map/user spezifisch)
|
||||||
|
if (!userToggledPolyline.current) {
|
||||||
dispatch(initializePolylineFromLocalStorageThunk());
|
dispatch(initializePolylineFromLocalStorageThunk());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, [dispatch, polylineVisible, map]);
|
}, [dispatch, polylineVisible, map]);
|
||||||
|
// Callback für Checkbox-Umschaltung (Kabelstrecken)
|
||||||
|
const handlePolylineCheckboxChange = useCallback(
|
||||||
|
checked => {
|
||||||
|
userToggledPolyline.current = true;
|
||||||
|
dispatch(setPolylineVisible(checked));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (linesData && Array.isArray(linesData)) {
|
if (linesData && Array.isArray(linesData)) {
|
||||||
const transformed = linesData.map(item => ({
|
const transformed = linesData.map(item => ({
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.344",
|
"version": "1.1.345",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.344",
|
"version": "1.1.345",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.344",
|
"version": "1.1.345",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user