diff --git a/src/renderer/routes/test_sequencer_panel/components/CyclePanel.tsx b/src/renderer/routes/test_sequencer_panel/components/CyclePanel.tsx index f19d9f3c2..2c804c12a 100644 --- a/src/renderer/routes/test_sequencer_panel/components/CyclePanel.tsx +++ b/src/renderer/routes/test_sequencer_panel/components/CyclePanel.tsx @@ -12,6 +12,7 @@ import { HoverCardContent, HoverCardTrigger, } from "@/renderer/components/ui/hover-card"; +import { useEffect, useState } from "react"; export function CyclePanel() { const { tree, isLocked } = useDisplayedSequenceState(); @@ -41,6 +42,19 @@ export function CyclePanel() { return null; } + const [value, setValue] = useState(1); + + const handleChange = (event: React.ChangeEvent) => { + if (event.target.value !== "") { + setCycleCount(Number(event.target.value)); + } + setValue(Number(event.target.value)); + }; + + useEffect(() => { + setValue(cycleConfig.cycleCount); + }, [cycleConfig.cycleCount]); + return ( @@ -65,10 +79,8 @@ export function CyclePanel() { id="cycle" placeholder="1" disabled={cycleConfig.infinite} - value={cycleConfig.cycleCount} - onChange={(event) => { - setCycleCount(Number(event.target.value)); - }} + value={value} + onChange={handleChange} />