fix(web/session): preload cast so parse runs at mount, not click

Without preload:true the player only parses the recording when the
user first clicks play. Any parse error during that lazy step
bypasses our lifecycle instrumentation (we only see "ready", which
just means UI mounted), and from the user's POV the play button
stays black because they never see the actual failure.

Forcing preload makes the driver's init() run synchronously-ish with
the "ready" dispatch, so getDuration() resolves to a real number
(or we see an "errored" event with a payload that tells us why).
This commit is contained in:
2026-04-24 10:25:42 -04:00
parent 4a8b13b392
commit b5c6b8a073

View File

@@ -148,7 +148,14 @@ const SessionDrawer: React.FC<SessionDrawerProps> = ({ decky, sid, fields, onClo
const p = AsciinemaPlayer.create(
{ data: cast },
playerContainer.current,
{ fit: 'width', terminalFontSize: '12px' },
{
fit: 'width',
terminalFontSize: '12px',
// Force parse up front. Without this the recording is only
// parsed on the user's click-to-play, and any parse failure
// there is invisible to our lifecycle instrumentation above.
preload: true,
},
);
playerInstance.current = p;
// The player's init() is async; any failure there bypasses the