Skip to content

Viewer: Try again when the first recording fails to open - #428

Merged
neuromechanist merged 3 commits into
stagingfrom
fix/issue-416-try-again
Oct 6, 2026
Merged

neuromechanist merged 3 commits into
stagingfrom
fix/issue-416-try-again

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Refs #416 (closing keywords do not close on staging; I will close it by hand after merging).

When the first open of a recording fails, the viewer showed an error and a link and nothing else: live is null, so the nav controls hide, and only a reload recovered. That matters most in the embed, where a partner's visitor has no surrounding page.

  • The failed-open message now carries a Try again button. It re-runs the same open through the session (openRecordingFrom), so it takes a new claim and is superseded and guarded like any other open. One change in viewer-session.ts, so the dataset page dialog and the embed both get it. A failed in-place navigation is unchanged.
  • The viewer's own "The viewer could not load this recording." message (a store that exists but would not open, an outage) offers Try again too, through a new onRetry option. Without it that case, the one the code comment names as Viewer: a Try again action when the first recording fails to open #416, would still have no way out. A missing store, a recorded data failure, a missing canvas and "no channel groups" do not get it: a retry cannot change them.
  • A failed retry says "Still couldn't open ...", so a click that changed nothing else still shows it did something. Focus goes to the new button, unless the visitor moved it elsewhere while the retry ran. The button is described by the message, so a screen reader reads both, and aria-busy clears before the message is inserted.
  • When the viewer's own code failed to load, the button reads Reload page. Chromium and WebKit remember a failed dynamic import() for the life of the document and answer the next one without asking the network (checked: one request, two failures), so a re-run would never recover from the most likely cause, a network blip on the viewer chunk. Firefox was not tested (the Playwright Firefox build hung here).
  • Reload keeps ?view=. Both reviewers found this: by the time the button is on screen the session has already stripped ?view= (nothing is live), so a bare reload landed an embed on a different recording, or the dataset page with no dialog, without a word. Reload now goes to the address with ?view= naming the failed recording (reloadUrl), so the embed reopens on the same recording and the dataset page reopens the dialog on it.
  • The module failure rides on the mount outcome (MountOutcome.moduleFailed), not on session state.
  • The dialog's present no longer calls showModal() on a dialog that is already open, because a retry re-presents into the open dialog.
  • Styles are in the shared eeg-viewer.css (.preview__retry, page tokens, --color-focus ring, light and dark).

Follow-ups, filed rather than carried: #429 (the inline viewer under a tree row has the same remembered-import dead end) and #430 (a throw after present() leaves "Loading viewer..." with no message, which predates this PR).

Verification

  • bun run typecheck, bun run lint, bun run test (3008 pass), including new unit tests for openFailureHtml (Try again, Still, Reload page, the description link, escaping) and reloadUrl (adds the view, replaces a stale one, keeps the version and the hash).
  • Playwright, Chromium and WebKit, against the dev server, every case with ?view=sub-23_task-BCCWJreading:
    • viewer code aborted once: label is Reload page, the URL had lost ?view= at that moment, the reload restores it and the embed opens sub-23;
    • mount throws once, then again on the first retry: Try again, then "Still couldn't open", focus on the new button, the third attempt mounts and no button is left;
    • store root request blocked, then restored: the viewer's own message shows Try again and the retry mounts;
    • the same mount throw on the dataset page dialog (deep link): Try again re-opens into the open dialog;
    • the viewer code aborted on the dataset page deep link: Reload page reopens the dialog on the same recording.
  • Screenshots at 360 px, light and dark (first revision): the button sits inline after the sentence, readable, tokens only.
  • Firefox not exercised.

A failed first open left an error and a link, and only a reload recovered.
The message now carries a Try again button that re-runs the same open through
the session (same claim and supersession), on the dialog and the embed. When
the viewer's code did not load, the button reads Reload and reloads the page,
since Chromium and WebKit cache a failed dynamic import for the document.

Tested: unit tests for the message; Playwright on Chromium and WebKit for the
embed (code fails to load, mount throws once and twice) and the dialog.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5cddc57
Status: ✅  Deploy successful!
Preview URL: https://39740bdf.nemar-website.pages.dev
Branch Preview URL: https://fix-issue-416-try-again.nemar-website.pages.dev

View logs

…view fixes

Reload page now goes to the address with ?view= naming the failed recording
(the failed open had already stripped it, so a bare reload opened a different
recording in an embed). The viewer's own 'could not load' message, for a store
that would not open, offers Try again too. A failed retry says 'Still
couldn't open', the button is described by the message, focus is restored only
when it was not moved, aria-busy clears before the message, and the module
failure rides on the mount outcome instead of session state.

Tested: unit tests for the message and reloadUrl; Playwright on Chromium and
WebKit for chunk failure, mount throw twice, store outage, dialog, and
dialog plus chunk failure, all with ?view=.
…le rule

The viewer's own Try again re-enables when its retry settles, the outage
message says 'still' after a failed retry, and isRetryableUnavailable keeps
the button and the message on one rule, with a test that they agree.

Tested: viewer and session unit tests; Playwright on Chromium and WebKit for
an outage that persists through one retry and then recovers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant