feat: WebSocket-Integration mit UI-Reaktivierung für GisStationsStaticDistrict

- WebSocket-Trigger implementiert, der `fetchGisStationsStaticDistrictThunk` ausführt.
- Trigger-Mechanismus über `useState` (`triggerUpdate`) sorgt für gezielten UI-Re-Render.
- Problem gelöst, dass Redux-Store zwar neue Daten enthielt, aber die UI nicht aktualisiert wurde.
- MapComponent.js und useDynamicDeviceLayers.js entsprechend angepasst.
This commit is contained in:
Ismail Ali
2025-06-09 00:24:33 +02:00
parent fbffc82e1b
commit b067a4c97e
12 changed files with 113 additions and 66 deletions

View File

@@ -178,6 +178,19 @@ function MapLayersControlPanel() {
console.log("📌 stationListing aktualisiert:", filteredAreas);
}
}, [GisStationsStaticDistrict, GisSystemStatic]);
//---------------------------
useEffect(() => {
const next = (GisStationsStaticDistrict.Points || []).map(p => p.Area_Name).join("|");
const current = stationListing.map(s => s.name).join("|");
if (next !== current) {
setStationListing(
GisStationsStaticDistrict.Points.map((area, index) => ({
id: index + 1,
name: area.Area_Name,
}))
);
}
}, [GisStationsStaticDistrict]);
//---------------------------
return (
@@ -194,9 +207,9 @@ function MapLayersControlPanel() {
style={{ minWidth: "150px", maxWidth: "200px" }}
>
<option value="Station wählen">Station wählen</option>
{stationListing.map(station => (
<option key={station.id} value={station.id}>
{station.name}
{(GisStationsStaticDistrict.Points || []).map((item, index) => (
<option key={index} value={item.IdLD}>
{item.Area_Name}
</option>
))}
</select>