diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e848631a..7ea48c081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie --- +## [1.1.132] – 2025-05-21 + +### Refactored + +- Entfernt: manuelle Fetch-Funktion und lokalen `isDataLoaded`-State für `DataSheet` +- Hinzugefügt: Anzeige des Panels erfolgt jetzt über Redux Store (`GisStationsStaticDistrict.Points`) +- Verbesserte Kontrolle über Sichtbarkeit der Layer-Steuerung auf Basis von Store-Daten + +--- + ## [1.1.130] – 2025-05-21 ### Changed diff --git a/components/mainComponent/MapComponent.js b/components/mainComponent/MapComponent.js index 9ac733b81..e8d2e20bb 100644 --- a/components/mainComponent/MapComponent.js +++ b/components/mainComponent/MapComponent.js @@ -796,50 +796,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { } }, [map]); //-------------------------------------------- - const fetchGisStationsStaticDistrict = async (idMap, idUser, dispatch) => { - try { - // API-Endpunkt mit Query-Parametern aufrufen - const response = await fetch(`/api/gisStationsStaticDistrict?m=${idMap}&u=${idUser}`); - if (!response.ok) { - throw new Error("Netzwerkantwort war nicht ok."); - } - - const data = await response.json(); - - // Ergebnis im Dispatch speichern oder State aktualisieren - dispatch({ type: "SET_GIS_STATIONS", payload: data }); - - //console.log("Daten erfolgreich geladen:", data); - return data; // Optional: Rückgabe der Daten - } catch (error) { - console.error("Fehler beim Laden der GIS-Daten:", error); - throw error; - } - }; - - const [isDataLoaded, setIsDataLoaded] = useState(false); - - useEffect(() => { - const fetchData = async () => { - try { - const idMap = 12; // Beispielwert für die Map-ID - const idUser = 484; // Beispielwert für die Benutzer-ID - - // Daten aus der API abrufen - await fetchGisStationsStaticDistrict(idMap, idUser, dispatch); - - setIsDataLoaded(true); // Daten erfolgreich geladen - } catch (error) { - console.error("Fehler beim Laden der Daten:", error); - setIsDataLoaded(false); // Fehler beim Laden - } - }; - - fetchData(); - }, [dispatch]); - - //-------------------------------------------- const handleCoordinatesSubmit = (coords) => { const [lat, lng] = coords.split(",").map(Number); if (map && lat && lng) { @@ -896,9 +853,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { }, [dispatch]); useEffect(() => { - dispatch(fetchGisStationsStaticDistrictThunk()); - }, [dispatch]); - + if (statusStaticDistrict === "idle") { + dispatch(fetchGisStationsStaticDistrictThunk()); + } + }, [statusStaticDistrict, dispatch]); useEffect(() => { dispatch(fetchGisStationsMeasurementsThunk()); }, [dispatch]); @@ -985,7 +943,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { )} - {isDataLoaded && } + {GisStationsStaticDistrict && GisStationsStaticDistrict.Points?.length > 0 && }
diff --git a/config/appVersion.js b/config/appVersion.js index a09a03c52..595614d35 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.131"; +export const APP_VERSION = "1.1.132";