fix(harmonia): printed PDF blob URL outlives its tab; popup-blocked prints download instead (#6511) - #6512
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6511.
The generated print flows (
document-page.js.template,manage/form-page.js.template) opened the rendered PDF atURL.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 deadblob:URL (the reported "it appeared, then it got removed"). Separately,window.openruns afterawaits — 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:
window.openreturns 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