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:
@@ -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>
|
||||
|
||||
@@ -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
BIN
public/images/OPCUA.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
Reference in New Issue
Block a user