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:
@@ -11,10 +11,23 @@ const slice = createSlice({
|
||||
status: "idle",
|
||||
error: null,
|
||||
},
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
reducers: {
|
||||
setGisStationsStaticDistrict: (state, action) => {
|
||||
// Stelle sicher, dass die Struktur immer gleich bleibt
|
||||
if (Array.isArray(action.payload)) {
|
||||
state.data = { Points: action.payload };
|
||||
} else if (action.payload?.Points) {
|
||||
state.data = { Points: action.payload.Points };
|
||||
} else {
|
||||
state.data = { Points: [] };
|
||||
}
|
||||
state.status = "succeeded";
|
||||
state.lastUpdated = Date.now();
|
||||
},
|
||||
}, // Ende der reducers
|
||||
extraReducers: builder => {
|
||||
builder
|
||||
.addCase(fetchGisStationsStaticDistrictThunk.pending, (state) => {
|
||||
.addCase(fetchGisStationsStaticDistrictThunk.pending, state => {
|
||||
state.status = "loading";
|
||||
})
|
||||
.addCase(fetchGisStationsStaticDistrictThunk.fulfilled, (state, action) => {
|
||||
@@ -28,5 +41,6 @@ const slice = createSlice({
|
||||
},
|
||||
});
|
||||
|
||||
export const selectGisStationsStaticDistrict = (state) => state.gisStationsStaticDistrict.data;
|
||||
export const selectGisStationsStaticDistrict = state => state.gisStationsStaticDistrict.data;
|
||||
export default slice.reducer;
|
||||
export const { setGisStationsStaticDistrict } = slice.actions;
|
||||
|
||||
Reference in New Issue
Block a user