fix: Typfehler in useLoopDisplay und Kue705FO behoben, Build erfolgreich
- 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 🚀
This commit is contained in:
@@ -15,6 +15,7 @@ import { setActiveMode } from "../../../../redux/slices/kueChartModeSlice";
|
|||||||
import handleButtonClick from "./kue705FO-Funktionen/handleButtonClick";
|
import handleButtonClick from "./kue705FO-Funktionen/handleButtonClick";
|
||||||
import { setChartOpen } from "../../../../redux/slices/kabelueberwachungChartSlice";
|
import { setChartOpen } from "../../../../redux/slices/kabelueberwachungChartSlice";
|
||||||
import { setSlotNumber } from "../../../../redux/slices/kabelueberwachungChartSlice";
|
import { setSlotNumber } from "../../../../redux/slices/kabelueberwachungChartSlice";
|
||||||
|
import { createTDRChart } from "../../../../utils/chartUtils";
|
||||||
//-------hooks----------------
|
//-------hooks----------------
|
||||||
import useChartPlugin from "./hooks/useChartPlugin";
|
import useChartPlugin from "./hooks/useChartPlugin";
|
||||||
import useAlarmStatus from "./hooks/useAlarmStatus";
|
import useAlarmStatus from "./hooks/useAlarmStatus";
|
||||||
@@ -174,7 +175,13 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
|||||||
modulName
|
modulName
|
||||||
);
|
);
|
||||||
|
|
||||||
const loopDisplayValue = useLoopDisplay(schleifenwiderstand, activeButton);
|
const { loopDisplayValue, setLoopDisplayValue } = useLoopDisplay(
|
||||||
|
typeof schleifenwiderstand === "number"
|
||||||
|
? schleifenwiderstand
|
||||||
|
: Number(schleifenwiderstand),
|
||||||
|
activeButton
|
||||||
|
);
|
||||||
|
|
||||||
const zoomPlugin = useChartPlugin();
|
const zoomPlugin = useChartPlugin();
|
||||||
useChartData(loopMeasurementCurveChartData);
|
useChartData(loopMeasurementCurveChartData);
|
||||||
|
|
||||||
@@ -304,7 +311,10 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
|||||||
"Schleife",
|
"Schleife",
|
||||||
setActiveButton,
|
setActiveButton,
|
||||||
setloopTitleText,
|
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
|
Number(schleifenwiderstand), // <- Stelle sicher, dass es eine Zahl ist
|
||||||
tdrLocation,
|
tdrLocation,
|
||||||
slotIndex,
|
slotIndex,
|
||||||
@@ -325,7 +335,10 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
|||||||
"TDR",
|
"TDR",
|
||||||
setActiveButton,
|
setActiveButton,
|
||||||
setloopTitleText,
|
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
|
Number(schleifenwiderstand), // <- Stelle sicher, dass es eine Zahl ist
|
||||||
tdrLocation,
|
tdrLocation,
|
||||||
slotIndex,
|
slotIndex,
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ const useLoopDisplay = (
|
|||||||
schleifenwiderstand: number,
|
schleifenwiderstand: number,
|
||||||
activeButton: "Schleife" | "TDR"
|
activeButton: "Schleife" | "TDR"
|
||||||
) => {
|
) => {
|
||||||
const [loopDisplayValue, setLoopDisplayValue] = useState(schleifenwiderstand);
|
const [loopDisplayValue, setLoopDisplayValue] =
|
||||||
|
useState<number>(schleifenwiderstand);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (activeButton === "Schleife") {
|
if (activeButton === "Schleife") {
|
||||||
@@ -13,7 +14,7 @@ const useLoopDisplay = (
|
|||||||
}
|
}
|
||||||
}, [schleifenwiderstand, activeButton]);
|
}, [schleifenwiderstand, activeButton]);
|
||||||
|
|
||||||
return loopDisplayValue;
|
return { loopDisplayValue, setLoopDisplayValue };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useLoopDisplay;
|
export default useLoopDisplay;
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const webVersion = "1.6.105";
|
const webVersion = "1.6.106";
|
||||||
export default webVersion;
|
export default webVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user