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:
@@ -148,7 +148,14 @@ const SessionDrawer: React.FC<SessionDrawerProps> = ({ decky, sid, fields, onClo
|
|||||||
const p = AsciinemaPlayer.create(
|
const p = AsciinemaPlayer.create(
|
||||||
{ data: cast },
|
{ data: cast },
|
||||||
playerContainer.current,
|
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;
|
playerInstance.current = p;
|
||||||
// The player's init() is async; any failure there bypasses the
|
// The player's init() is async; any failure there bypasses the
|
||||||
|
|||||||
Reference in New Issue
Block a user