From f8e76b52a6d2ef9f92c360bc0a127cfe81c0046e Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 24 Feb 2025 14:52:51 +0100 Subject: [PATCH] fix: Typfehler in useLoopDisplay und Kue705FO behoben, Build erfolgreich MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - useLoopDisplay.ts angepasst: useState nun explizit als `number` deklariert - Typensicherheit in Kue705FO.tsx verbessert: - `schleifenwiderstand` wird immer als `number` konvertiert - `setLoopDisplayValue` akzeptiert nur `number` - Fehlerhafte Typzuweisung in `handleButtonClick` korrigiert - `npm run build` läuft nun ohne Fehler ✅ Code nun sauber typisiert, keine TypeScript-Fehler mehr 🚀 --- .../kabelueberwachung/kue705FO/Kue705FO.tsx | 19 ++++++++++++++++--- .../kue705FO/hooks/useLoopDisplay.ts | 5 +++-- config/webVersion.ts | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx b/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx index d0e2069..e09d9ab 100644 --- a/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx +++ b/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx @@ -15,6 +15,7 @@ import { setActiveMode } from "../../../../redux/slices/kueChartModeSlice"; import handleButtonClick from "./kue705FO-Funktionen/handleButtonClick"; import { setChartOpen } from "../../../../redux/slices/kabelueberwachungChartSlice"; import { setSlotNumber } from "../../../../redux/slices/kabelueberwachungChartSlice"; +import { createTDRChart } from "../../../../utils/chartUtils"; //-------hooks---------------- import useChartPlugin from "./hooks/useChartPlugin"; import useAlarmStatus from "./hooks/useAlarmStatus"; @@ -174,7 +175,13 @@ const Kue705FO: React.FC = ({ modulName ); - const loopDisplayValue = useLoopDisplay(schleifenwiderstand, activeButton); + const { loopDisplayValue, setLoopDisplayValue } = useLoopDisplay( + typeof schleifenwiderstand === "number" + ? schleifenwiderstand + : Number(schleifenwiderstand), + activeButton + ); + const zoomPlugin = useChartPlugin(); useChartData(loopMeasurementCurveChartData); @@ -304,7 +311,10 @@ const Kue705FO: React.FC = ({ "Schleife", setActiveButton, setloopTitleText, - setLoopDisplayValue, + (value) => + setLoopDisplayValue( + typeof value === "number" ? value : Number(value) + ), // Hier sicherstellen, dass nur number übergeben wird Number(schleifenwiderstand), // <- Stelle sicher, dass es eine Zahl ist tdrLocation, slotIndex, @@ -325,7 +335,10 @@ const Kue705FO: React.FC = ({ "TDR", setActiveButton, setloopTitleText, - setLoopDisplayValue, + (value) => + setLoopDisplayValue( + typeof value === "number" ? value : Number(value) + ), // Hier sicherstellen, dass nur number übergeben wird Number(schleifenwiderstand), // <- Stelle sicher, dass es eine Zahl ist tdrLocation, slotIndex, diff --git a/components/main/kabelueberwachung/kue705FO/hooks/useLoopDisplay.ts b/components/main/kabelueberwachung/kue705FO/hooks/useLoopDisplay.ts index 6908444..1c2f901 100644 --- a/components/main/kabelueberwachung/kue705FO/hooks/useLoopDisplay.ts +++ b/components/main/kabelueberwachung/kue705FO/hooks/useLoopDisplay.ts @@ -5,7 +5,8 @@ const useLoopDisplay = ( schleifenwiderstand: number, activeButton: "Schleife" | "TDR" ) => { - const [loopDisplayValue, setLoopDisplayValue] = useState(schleifenwiderstand); + const [loopDisplayValue, setLoopDisplayValue] = + useState(schleifenwiderstand); useEffect(() => { if (activeButton === "Schleife") { @@ -13,7 +14,7 @@ const useLoopDisplay = ( } }, [schleifenwiderstand, activeButton]); - return loopDisplayValue; + return { loopDisplayValue, setLoopDisplayValue }; }; export default useLoopDisplay; diff --git a/config/webVersion.ts b/config/webVersion.ts index 6916a26..d8003b0 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -6,5 +6,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.105"; +const webVersion = "1.6.106"; export default webVersion;