commit 9c6f421c94d892471c209c357ce97a86f6a3a35b
parent bc7f2df60843986fa5f415282c251636ec93d090
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 4 Nov 2026 17:26:31 -0500
umtool: Play: a post item fetched ahead plays on at once (no grace wait for its player) -- its card a srcdoc drawn in a frame, its voice due `lead` in from a blob; the wait was a 50-150 ms hitch at every item of a fast burst. Only an item not fetched ahead waits for its player to say it is ready
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx
@@ -249,8 +249,6 @@ function approximateLine(edges: RenderCuts, info: EngineInfo | null) {
const PRELOAD_AHEAD_S = 20;
const PRELOAD_MIN = 3;
const PRELOAD_MAX = 24;
-/** An item fetched ahead plays once its player says it is ready, or this long after it is first on screen. */
-const GATE_GRACE_MS = 400;
/** The clock never waits longer than this on one item (a page that never says it is ready). */
const GATE_MAX_MS = 15_000;
@@ -411,8 +409,8 @@ export default function PlayCut({
);
// THE GATE (engine.ts): a post item plays once its player is ready -- its card drawn, its voice and its first
// attachment able to play -- and the clock waits on it, never cutting it short (a buffer stall's wait). Fetched
- // ahead (postPreload.ts), it is ready as it comes on screen; the clock holds on the item before while it is
- // still fetching. `postReady`: the item whose player said so (one is mounted at a time).
+ // ahead (postPreload.ts), it is ready as it comes on screen, with no wait; the clock holds on the item before
+ // while it is still fetching. `postReady`: the item whose player said so (one is mounted at a time).
const entryOfRef = useRef(entryOf);
entryOfRef.current = entryOf;
const postReady = useRef<string | null>(null);
@@ -427,8 +425,9 @@ export default function PlayCut({
if (now - since > GATE_MAX_MS) return "ready";
const st = postPreload.itemState(id);
if (next) return st === "loading" ? "fetching" : "ready";
- if (postReady.current === id) return "ready";
- return st === "ready" && now - since > GATE_GRACE_MS ? "ready" : "wait";
+ // Fetched ahead, it plays on at once: its card is a srcdoc drawn in a frame, its voice (due `lead` in) a blob.
+ // Else it waits for its player to say it is ready.
+ return st === "ready" || postReady.current === id ? "ready" : "wait";
}, []);
const onPostReady = useCallback((id: string) => {
postReady.current = id;