refactor: entferne manuelles fetchGisStationsMeasurements und nutze Redux-Store
- 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
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// /config/appVersion
|
||||
export const APP_VERSION = "1.1.150";
|
||||
export const APP_VERSION = "1.1.151";
|
||||
|
||||
Reference in New Issue
Block a user