WIP: KÜ Modal Einstellung Bezeichnung funktioniert, aber die andere Werte muss noch bearbeitet werden
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
"use client"; // KueEinstellung.tsx – komplett angepasst mit window.__kueCache zum Schutz vor Remount-Reset
|
||||
// KueEinstellung.tsx – vollständige Version mit handleSave eingebunden
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import type { RootState } from "../../../../../redux/store";
|
||||
import { setKueData } from "../../../../../redux/slices/kueDataSlice";
|
||||
import handleSave from "../handlers/handleSave";
|
||||
import handleDisplayEinschalten from "../handlers/handleDisplayEinschalten";
|
||||
import firmwareUpdate from "../handlers/firmwareUpdate";
|
||||
import { useAdminAuth } from "../../../settingsPageComponents/hooks/useAdminAuth";
|
||||
@@ -31,8 +33,8 @@ export default function KueEinstellung({
|
||||
slot,
|
||||
showModal,
|
||||
onClose = () => {},
|
||||
onModulNameChange,
|
||||
}: Props) {
|
||||
const dispatch = useDispatch();
|
||||
const {
|
||||
kueID,
|
||||
kueLimit1,
|
||||
@@ -43,12 +45,12 @@ export default function KueEinstellung({
|
||||
} = useSelector((state: RootState) => state.kueDataSlice);
|
||||
|
||||
const { isAdminLoggedIn } = useAdminAuth(true);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const formCacheKey = `slot_${slot}`;
|
||||
if (typeof window !== "undefined") {
|
||||
window.__kueCache = window.__kueCache || {};
|
||||
}
|
||||
|
||||
const cached =
|
||||
typeof window !== "undefined" ? window.__kueCache?.[formCacheKey] : null;
|
||||
|
||||
@@ -68,7 +70,7 @@ export default function KueEinstellung({
|
||||
const updated = { ...formData, [key]: value };
|
||||
setFormData(updated);
|
||||
if (typeof window !== "undefined") {
|
||||
window.__kueCache[formCacheKey] = updated;
|
||||
window.__kueCache![formCacheKey] = updated;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -91,22 +93,32 @@ export default function KueEinstellung({
|
||||
const updatedMemoryInterval = [...memoryInterval];
|
||||
updatedMemoryInterval[slot] = Number(formData.memoryInterval);
|
||||
|
||||
dispatch(
|
||||
setKueData({
|
||||
kueID: updatedKueID,
|
||||
kueLimit1: updatedLimit1,
|
||||
kueDelay1: updatedDelay1,
|
||||
kueLimit2Low: updatedLimit2Low,
|
||||
kueLoopInterval: updatedLoopInterval,
|
||||
memoryInterval: updatedMemoryInterval,
|
||||
})
|
||||
);
|
||||
handleSave({
|
||||
ids: updatedKueID,
|
||||
isolationsgrenzwerte: updatedLimit1,
|
||||
verzoegerung: updatedDelay1,
|
||||
untereSchleifenGrenzwerte: updatedLimit2Low,
|
||||
obereSchleifenGrenzwerte: updatedLimit2Low,
|
||||
schleifenintervall: updatedLoopInterval,
|
||||
speicherintervall: updatedMemoryInterval,
|
||||
originalValues: {
|
||||
kueID,
|
||||
isolationsgrenzwerte: kueLimit1,
|
||||
verzoegerung: kueDelay1,
|
||||
untereSchleifenGrenzwerte: kueLimit2Low,
|
||||
obereSchleifenGrenzwerte: kueLimit2Low,
|
||||
schleifenintervall: kueLoopInterval,
|
||||
speicherintervall: memoryInterval,
|
||||
},
|
||||
slot,
|
||||
dispatch, // du kannst dispatch hier übergeben, falls nötig
|
||||
onModulNameChange: onModulNameChange ?? (() => {}),
|
||||
onClose,
|
||||
});
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
delete window.__kueCache[formCacheKey];
|
||||
delete window.__kueCache?.[formCacheKey];
|
||||
}
|
||||
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||
|
||||
*/
|
||||
const webVersion = "1.6.316";
|
||||
const webVersion = "1.6.317";
|
||||
export default webVersion;
|
||||
|
||||
@@ -11,24 +11,11 @@
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
"types": [
|
||||
"cypress",
|
||||
"node"
|
||||
],
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"types": ["cypress", "node"],
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"incremental": true
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
"include": ["src", "**/*.test.ts", "**/*.test.tsx", "types/global.d.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
9
types/global.d.ts
vendored
Normal file
9
types/global.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// types/global.d.ts
|
||||
export {};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__kueCache?: Record<string, any>;
|
||||
kabelModalOpen?: boolean; // ✅ HIER NEU
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user