wip(spf): cast instead of re-guarding resolved presentation in the derive effect

#5 review: the isResolvedPresentation guard in the derive effect's update() was
runtime-redundant — the monitor gates `monitoring` on a resolved presentation and
transitions before effects re-run, so `current` is always resolved there. Drop the
guard and cast to `Presentation`, with a comment citing the invariant.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christian Pillsbury
2026-07-10 07:30:30 -07:00
co-authored by Claude Opus 4.8
parent b820064b77
commit a304067c53
@@ -157,8 +157,11 @@ function establishStartMediaTimeSetup({
const containerData = state.mediaContainerData.get();
if (!containerData) return;
const startMediaTimes = derive(containerData, selectionContext());
// `current` is always resolved here — the monitor gates `monitoring` on a
// resolved presentation and transitions before effects re-run — so we cast
// to `Presentation` rather than re-narrowing.
update(state.presentation as Signal<MaybeResolvedPresentation>, (current) =>
isResolvedPresentation(current) ? stampTracks(current, startMediaTimes) : current
stampTracks(current as Presentation, startMediaTimes)
);
},
},