Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix set cycle #1162

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/renderer/routes/test_sequencer_panel/components/CyclePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
HoverCardContent,
HoverCardTrigger,
} from "@/renderer/components/ui/hover-card";
import { useEffect, useState } from "react";

export function CyclePanel() {
const { tree, isLocked } = useDisplayedSequenceState();
Expand Down Expand Up @@ -41,6 +42,19 @@
return null;
}

const [value, setValue] = useState(1);

Check failure on line 45 in src/renderer/routes/test_sequencer_panel/components/CyclePanel.tsx

View workflow job for this annotation

GitHub Actions / ts-code-style

React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.value !== "") {
setCycleCount(Number(event.target.value));
}
setValue(Number(event.target.value));
};

useEffect(() => {

Check failure on line 54 in src/renderer/routes/test_sequencer_panel/components/CyclePanel.tsx

View workflow job for this annotation

GitHub Actions / ts-code-style

React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render
setValue(cycleConfig.cycleCount);
}, [cycleConfig.cycleCount]);

return (
<HoverCard>
<HoverCardTrigger asChild>
Expand All @@ -65,10 +79,8 @@
id="cycle"
placeholder="1"
disabled={cycleConfig.infinite}
value={cycleConfig.cycleCount}
onChange={(event) => {
setCycleCount(Number(event.target.value));
}}
value={value}
onChange={handleChange}
/>
</div>
<div className="grow" />
Expand Down
Loading