commit 97a9a4f684455310a830613f8ac8527664499fd5
parent 9e7a26459483dd22da6b70244199668a69408658
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 1 Nov 2026 02:16:23 -0500
umtool: the flash-forward form's default (the start of the clip's section) never overrides a choice made before the sections came back
The full suite caught it: under load the timeline read returned after "after (the start)" and "move" were chosen, and the span went to the section instead.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/umtool/components/projects/review/CutEditing.tsx b/umtool/components/projects/review/CutEditing.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { buttonVariants } from "@/components/ui/button";
import { edgeClock } from "@/lib/report/clipEditorModel.mjs";
@@ -42,6 +42,8 @@ export function FlashForwardForm({
const [after, setAfter] = useState<string>("");
const [section, setSection] = useState<string>("");
const [move, setMove] = useState(false);
+ // A choice made before the sections came back is the person's: the default never overrides it.
+ const touched = useRef(false);
useEffect(() => {
let live = true;
void fetch(`/api/report/timeline?project=${encodeURIComponent(project)}`, { cache: "no-store" })
@@ -54,7 +56,7 @@ export function FlashForwardForm({
setSections(secs);
// A flash-forward goes EARLIER: by default, the start of the section this clip is in.
const mine = secs.find((s) => s.clips.includes(clipId));
- if (mine && secs.length > 1) {
+ if (mine && secs.length > 1 && !touched.current) {
setWhere("section");
setSection(String(mine.index));
}
@@ -86,9 +88,9 @@ export function FlashForwardForm({
<div className="flex flex-wrap items-center gap-2">
{sections.length > 1 && (
<label className="inline-flex items-center gap-1">
- <input type="radio" name="ff-where" checked={where === "section"} onChange={() => setWhere("section")} data-testid="ff-where-section" />
+ <input type="radio" name="ff-where" checked={where === "section"} onChange={() => ((touched.current = true), setWhere("section"))} data-testid="ff-where-section" />
at the start of
- <select data-testid="ff-section" value={section} onChange={(e) => (setSection(e.target.value), setWhere("section"))} className={input}>
+ <select data-testid="ff-section" value={section} onChange={(e) => ((touched.current = true), setSection(e.target.value), setWhere("section"))} className={input}>
{sections.map((s) => (
<option key={s.index} value={s.index}>
{s.words}
@@ -98,9 +100,9 @@ export function FlashForwardForm({
</label>
)}
<label className="inline-flex items-center gap-1">
- <input type="radio" name="ff-where" checked={where === "after"} onChange={() => setWhere("after")} data-testid="ff-where-after" />
+ <input type="radio" name="ff-where" checked={where === "after"} onChange={() => ((touched.current = true), setWhere("after"))} data-testid="ff-where-after" />
after
- <select data-testid="ff-after" value={after} onChange={(e) => (setAfter(e.target.value), setWhere("after"))} className={input}>
+ <select data-testid="ff-after" value={after} onChange={(e) => ((touched.current = true), setAfter(e.target.value), setWhere("after"))} className={input}>
<option value="">(the start)</option>
{entries.map((e, i) => (
<option key={`${e.id}:${i}`} value={e.id}>
diff --git a/umtool/e2e/cut-flash.spec.ts b/umtool/e2e/cut-flash.spec.ts
@@ -97,6 +97,8 @@ test("move it out: the span leaves the clip, which keeps the rest", async ({ pag
await openOn(page, "r003");
await select(page, 7.4, 8.5);
await page.locator('[data-action="flash-forward"]').click();
+ // The sections have come back (the form's default is the start of r003's section).
+ await expect(page.getByTestId("ff-where-section")).toBeChecked();
await page.getByTestId("ff-where-after").check();
await page.getByTestId("ff-after").selectOption("");
await page.getByTestId("ff-move").check();