fix: aktiver Tab im KueModal bleibt erhalten, kein Zurückspringen auf "kue" mehr

- Tab-Zustand wird in window.__lastKueTab gespeichert
- Verhindert automatische Rücksetzung bei Re-Render oder showModal-Änderung
- Nutzer bleibt auf dem zuletzt aktiven Tab (TDR, Knotenpunkte etc.)
This commit is contained in:
Ismail Ali
2025-04-22 19:55:12 +02:00
parent 6f4f916421
commit 5aaedc346d
3 changed files with 15 additions and 9 deletions

View File

@@ -9,17 +9,24 @@ interface KueModalProps {
showModal: boolean;
onClose: () => void;
slot: number;
onModulNameChange: (id: string) => void; // NEU!
onModulNameChange: (id: string) => void;
}
export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "knoten">("kue");
useEffect(() => {
if (showModal) {
setActiveTab("kue");
// 🧠 Tab wird initial nur einmal aus globalem Speicher geladen
const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "knoten">(() => {
if (typeof window !== "undefined" && (window as any).__lastKueTab) {
return (window as any).__lastKueTab;
}
}, [showModal]);
return "kue";
});
// 🔁 Bei jeder Tab-Änderung speichern wir ihn global
useEffect(() => {
if (typeof window !== "undefined") {
(window as any).__lastKueTab = activeTab;
}
}, [activeTab]);
return (
<ReactModal
@@ -96,7 +103,6 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
onClose={onClose}
/>
)}
{activeTab === "tdr" && <TdrEinstellung slot={slot} />}
{activeTab === "knoten" && <Knotenpunkte slot={slot} />}
</div>

View File

@@ -6,5 +6,5 @@
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
*/
const webVersion = "1.6.253";
const webVersion = "1.6.254";
export default webVersion;

BIN
public/images/OPCUA.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB