Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 4995a03703655b2f9441cbad23e1da37360232db
parent 8b6965dbbe39c53acc3b6b0617137a0e69a791c5
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 10 Nov 2026 14:21:31 -0500

umtool: present mode's slides read once per entry, a reading overtaken by a newer one dropped (no cancel on an effect's cleanup: StrictMode's second run would leave it loading)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/components/projects/workspace/Workspace.tsx | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/umtool/components/projects/workspace/Workspace.tsx b/umtool/components/projects/workspace/Workspace.tsx @@ -371,29 +371,29 @@ export default function Workspace({ presentInitial ? { state: "ready", payload: presentInitial } : null, ); const presentRead = useRef(!!presentInitial); + const presentSeq = useRef(0); useEffect(() => { if (mode !== "present") { presentRead.current = false; + presentSeq.current += 1; return; } setPlaying(false); + // Read once per entry (the draft may have changed since the last); a reading overtaken by a newer one is dropped. if (presentRead.current) return; presentRead.current = true; - let live = true; + const mine = ++presentSeq.current; setPresent({ state: "loading" }); void (async () => { try { const r = await fetch(`/api/report/present?${new URLSearchParams({ project, ...(takeId ? { take: takeId } : {}) }).toString()}`, { cache: "no-store" }); const j = (await r.json().catch(() => ({}))) as PresentPayload & { error?: string }; - if (!live) return; + if (mine !== presentSeq.current) return; setPresent(r.ok && !j.error ? { state: "ready", payload: j } : { state: "error", error: j.error ?? `HTTP ${r.status}` }); } catch (e) { - if (live) setPresent({ state: "error", error: e instanceof Error ? e.message : String(e) }); + if (mine === presentSeq.current) setPresent({ state: "error", error: e instanceof Error ? e.message : String(e) }); } })(); - return () => { - live = false; - }; }, [mode, project, takeId, setPlaying]); const move = useCallback(