From 41e270cc53ff2a921dd281f1aebc6b03504f3fff Mon Sep 17 00:00:00 2001 From: ISA Date: Thu, 22 May 2025 15:14:42 +0200 Subject: [PATCH] refactor: entferne manuelles fetchGisStationsMeasurements und nutze Redux-Store MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - entferne alten updateGmaData useEffect aus MapComponent.js - verwende gisStationsMeasurements-Daten direkt aus Redux-Slice - setze useSelector statt useState für GisStationsMeasurements - beseitigt Fehler beim Abrufen der GMA-Daten in der Konsole - vereinheitlicht Datenfluss über Redux Toolkit --- components/mainComponent/MapComponent.js | 41 ++---------------------- config/appVersion.js | 2 +- 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/components/mainComponent/MapComponent.js b/components/mainComponent/MapComponent.js index 490cdcdf4..826faf938 100644 --- a/components/mainComponent/MapComponent.js +++ b/components/mainComponent/MapComponent.js @@ -95,10 +95,11 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { const gisLinesStatus = useSelector((state) => state.gisLinesStatusFromWebservice.status); const { data: gisLinesStatusData, status: statusGisLinesStatus } = useSelector(selectGisLinesStatusFromWebservice); - useEffect(() => { + + /* useEffect(() => { console.log("✅ Redux: gisLinesStatusData:", gisLinesStatusData); }, [gisLinesStatusData]); - + */ //------------------------------- const { deviceName, setDeviceName } = useMapComponentState(); const [locationDeviceData, setLocationDeviceData] = useState([]); @@ -517,43 +518,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { initializeContextMenu(); }, [map]); - //-------------------------------------------- - //Tooltip Werte aktualisieren - useEffect(() => { - if (!map) return; // Stelle sicher, dass die Karte initialisiert ist - const updateGmaData = async () => { - try { - const fetchOptions = { - method: "GET", - headers: { - Connection: "close", - }, - }; - - // Aktualisiere die Messdaten - await fetchGisStationsMeasurements(setGisStationsMeasurements, fetchOptions); - - // Aktualisiere die Marker-Layer - // useGmaMarkersLayer(map, gmaMarkers, GisStationsMeasurements, layers.MAP_LAYERS.GMA, oms); - } catch (error) { - console.error("Fehler beim Aktualisieren der GMA-Daten:", error); - } - }; - - // Initialer Datenabruf - updateGmaData(); - - // Setze ein Intervall, um die Daten alle 5 Sekunden zu aktualisieren - /* const intervalId = setInterval(() => { - updateGmaData(); - }, 5000); - - // Cleanup-Funktion, um das Intervall zu entfernen, wenn die Komponente entladen wird - return () => clearInterval(intervalId); */ - }, [map, gmaMarkers, layers.MAP_LAYERS.GMA, oms]); - - //--------------------------------- //--------------hokks------------------------------------------- useGmaMarkersLayer( diff --git a/config/appVersion.js b/config/appVersion.js index 8e07be8fb..b17893dc9 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.150"; +export const APP_VERSION = "1.1.151";