commit cc71c1d7e0a495677b6b092c71c093be7ba1dc22
parent 21e1ae6cc515e382781d875fd30b75f1f47ecd9d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 4 Nov 2026 14:34:08 -0500
umtool: Play's card measure keeps main's identity -- the plan, layout and clock read through a ref, the clock placed by its own effect -- so a re-measure never lays a pushed-in word zoom out flat mid-zoom (post-narration e2e, "A WORD ZOOM", after the merge)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/umtool/components/projects/review/PostItemPlayer.tsx b/umtool/components/projects/review/PostItemPlayer.tsx
@@ -557,7 +557,12 @@ export default function PostItemPlayer({
const follow = plan.follow ?? null;
const [followGeo, setFollowGeo] = useState<ReturnType<typeof measureFollow>>(null);
const followRoute = useMemo(() => (follow && followGeo ? followPath(follow, followGeo) : null), [follow, followGeo]);
+ // The plan, the layout and the clock as they are now, read by measure through a ref: its identity (and so a
+ // re-measure, which lays the card out untransformed) changes only with what it measured before (main's deps).
+ const live0 = useRef({ plan, layout, clock });
+ live0.current = { plan, layout, clock };
const measure = useCallback(() => {
+ const { plan, layout, clock } = live0.current;
const doc = readFrame.current?.contentDocument;
if (!doc || doc.body?.getAttribute("data-post-ready") !== "1") return false;
const card = doc.querySelector("[data-post-card]") as HTMLElement | null;
@@ -645,7 +650,7 @@ export default function PostItemPlayer({
}
setCaps(placedCaps);
return true;
- }, [entry, zoomTimes, box.height, follow, layout.mode, layout.slot, plan.steps, plan.total, plan.narration, clock]);
+ }, [entry, zoomTimes, box.height, follow]);
// ---- the clock, live: mounted and placed once the page is drawn, set each tick ----
const [clockAt, setClockAt] = useState<{ x: number; y: number } | null>(null);
const placeClock = useCallback(() => {
@@ -666,15 +671,21 @@ export default function PostItemPlayer({
if (follow && route) applyFollowState(followStateAt(follow, route, 0), doc);
setClockAt(at ? { x: at.x, y: at.y } : null);
}, [clock, box.height, follow, plan.total]);
+ const placeClockRef = useRef(placeClock);
+ placeClockRef.current = placeClock;
const onFrameLoad = useCallback(() => {
let tries = 0;
const tick = () => {
- placeClock();
+ placeClockRef.current();
if (measure() || tries++ > 50) return;
setTimeout(tick, 100);
};
tick();
- }, [measure, placeClock]);
+ }, [measure]);
+ // The clock placed again when it changes (another item before, a knob).
+ useEffect(() => {
+ placeClock();
+ }, [placeClock]);
useEffect(() => {
// The item changed under a loaded page (a knob, a zoom added): measure again.
onFrameLoad();