Skip to content

fix(harmonia): printed PDF blob URL outlives its tab; popup-blocked prints download instead (#6511) - #6512

Merged
delchev merged 1 commit into
masterfrom
fix/print-blob-lifetime
Aug 4, 2026
Merged

fix(harmonia): printed PDF blob URL outlives its tab; popup-blocked prints download instead (#6511)#6512
delchev merged 1 commit into
masterfrom
fix/print-blob-lifetime

Conversation

@delchev

@delchev delchev commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes #6511.

The generated print flows (document-page.js.template, manage/form-page.js.template) opened the rendered PDF at URL.createObjectURL(blob) and revoked it on a 60-second timer. Revoking does not close the tab — it kills the URL under the still-open PDF viewer, so a reload or print from that tab after the timer fails with a dead blob: URL (the reported "it appeared, then it got removed"). Separately, window.open runs after awaits — outside the click's gesture stack — so a popup blocker made the print fail with no visible error (window.open → null).

Two changes, both print sites:

  • No timed revoke. The object URL is released when the SPA page unloads — the blob's natural owner lifetime. A print-sized PDF held until then costs nothing, and the opened tab stays reloadable/printable indefinitely.
  • Popup-blocked fallback. When window.open returns null, the PDF downloads via a temporary anchor (download="<Entity>-<id>.pdf"), which browsers always allow without a gesture.

The report/export flows already use the safe immediate-download pattern (a.click() then revoke) and are untouched.

Template-only: reaches deployed apps on regeneration (same regen sweep that picks up the other print/UI fixes).

🤖 Generated with Claude Code

…page; popup-blocked prints download instead (#6510)

The generated print flows opened the rendered PDF at an object URL and
revoked it on a 60-second timer - which does not close the tab, it
kills the URL under the still-open viewer, so reloading or printing the
tab after the timer fails with a dead blob ("the file was removed").
And window.open runs after async work, outside the click's gesture
stack, so a popup blocker made the whole print fail silently.

The object URL now lives until the SPA page unloads (its natural owner
lifetime - a print-sized PDF held until then costs nothing), and a
blocked popup falls back to downloading the PDF via a temporary anchor,
which browsers always allow. The report/export flows already use the
safe immediate-download pattern and are untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@delchev delchev changed the title fix(harmonia): printed PDF blob URL outlives its tab; popup-blocked prints download instead (#6510) fix(harmonia): printed PDF blob URL outlives its tab; popup-blocked prints download instead (#6511) Aug 4, 2026
@delchev
delchev merged commit 3b849f7 into master Aug 4, 2026
9 checks passed
@delchev
delchev deleted the fix/print-blob-lifetime branch August 4, 2026 15:58
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.

Printed PDF tab breaks shortly after opening - the blob URL is revoked on a timer

1 participant