Skip to content

fix: prevent PDF preview loading-state race - #1172

Merged
hrsvrn merged 1 commit into
mainfrom
fix/pdf-preview-loading-test
Oct 8, 2026
Merged

hrsvrn merged 1 commit into
mainfrom
fix/pdf-preview-loading-test

Conversation

@hrsvrn

@hrsvrn hrsvrn commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

A PDF iframe can load before the viewer’s passive effect runs. That effect then resets the completed preview to “Loading PDF…”, causing the failure in main CI run #1198 and potentially leaving a fast-loading preview covered by its loading overlay.

Reset the viewer state by keying the stateful component to the file path instead of resetting it in an effect. Switching files still starts a fresh loading state, and events from an old iframe cannot update the new preview.

Validation:

  • Added a deterministic fast-load regression that fails before this fix and passes afterward.
  • Added coverage for switching files and ignoring old iframe load events.
  • Renderer TypeScript check passed.
  • Local-file, Spaces attachment, and PDF regression tests passed (9 tests).
  • Full renderer suite passed: 140 files, 1,150 tests (NODE_OPTIONS=--no-experimental-webstorage npm test -- --maxWorkers=4).

@hrsvrn
hrsvrn merged commit 0af8215 into main Oct 8, 2026
3 checks passed
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