Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

fix(convert-chip): move early return after all hook calls (#28)

chasel343db8975692ff
diff --git a/src/components/convert-chip.tsx b/src/components/convert-chip.tsx
index 14a57037..21d3b9d5 100644
--- a/src/components/convert-chip.tsx
+++ b/src/components/convert-chip.tsx
@@ -23,10 +23,6 @@ export function ConvertChip() {
const { run, cancel } = useConvert();
const t = useT();
- // Only show in split mode — when only one pane is visible there's no
- // divider to hang off, and the toolbar button is already obvious.
- if (layoutMode !== "split") return null;
-
const agentInfo = agents.find((a) => a.id === agent);
const model = agent ? agentModels[agent] ?? "default" : "default";
const canConvert =
@@ -55,6 +51,7 @@ export function ConvertChip() {
// Lives here (not in Toolbar) because the chip is the single source of
// Convert truth after the toolbar button was removed.
useEffect(() => {
+ if (layoutMode !== "split") return;
const onKey = (e: KeyboardEvent) => {
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
if (isRunning || !canConvert) return;
@@ -64,7 +61,11 @@ export function ConvertChip() {
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
- }, [onClick, isRunning, canConvert]);
+ }, [layoutMode, onClick, isRunning, canConvert]);
+
+ // Only show in split mode — when only one pane is visible there's no
+ // divider to hang off, and the toolbar button is already obvious.
+ if (layoutMode !== "split") return null;
return (
<div