fix: KUE-Einstellungen nach dem Speichern sofort lokal aktualisiert
- formData nach erfolgreichem handleSave manuell gesetzt - Alle Werte (Grenzwerte, Intervall etc.) werden direkt im UI angezeigt - Kein Navigieren oder Neuladen mehr nötig zur Sichtbarkeit - Cache aktualisiert, damit auch beim Wiederöffnen korrekte Werte angezeigt werden
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
// KueEinstellung.tsx – vollständige Version mit handleSave eingebunden
|
||||
// KueEinstellung.tsx – final überarbeitet: formData wird direkt nach dem Speichern aktualisiert
|
||||
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import type { RootState } from "../../../../../redux/store";
|
||||
import handleSave from "../handlers/handleSave";
|
||||
import handleDisplayEinschalten from "../handlers/handleDisplayEinschalten";
|
||||
@@ -35,6 +35,7 @@ export default function KueEinstellung({
|
||||
onClose = () => {},
|
||||
onModulNameChange,
|
||||
}: Props) {
|
||||
const dispatch = useDispatch();
|
||||
const {
|
||||
kueID,
|
||||
kueLimit1,
|
||||
@@ -45,7 +46,6 @@ export default function KueEinstellung({
|
||||
} = useSelector((state: RootState) => state.kueDataSlice);
|
||||
|
||||
const { isAdminLoggedIn } = useAdminAuth(true);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const formCacheKey = `slot_${slot}`;
|
||||
if (typeof window !== "undefined") {
|
||||
@@ -111,13 +111,24 @@ export default function KueEinstellung({
|
||||
speicherintervall: memoryInterval,
|
||||
},
|
||||
slot,
|
||||
dispatch, // du kannst dispatch hier übergeben, falls nötig
|
||||
dispatch,
|
||||
onModulNameChange: onModulNameChange ?? (() => {}),
|
||||
onClose,
|
||||
});
|
||||
|
||||
const newData = {
|
||||
name: updatedKueID[slot],
|
||||
limit1: updatedLimit1[slot].toString(),
|
||||
delay1: updatedDelay1[slot].toString(),
|
||||
limit2Low: updatedLimit2Low[slot].toString(),
|
||||
loopInterval: updatedLoopInterval[slot].toString(),
|
||||
memoryInterval: updatedMemoryInterval[slot].toString(),
|
||||
};
|
||||
|
||||
setFormData(newData);
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
delete window.__kueCache?.[formCacheKey];
|
||||
window.__kueCache![formCacheKey] = newData;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user