Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(exports): remove download anchor from the DOM after download (#68448)

Paul D'Ambra8f3f43404a6d
diff --git a/frontend/src/lib/components/ExportButton/exporter.tsx b/frontend/src/lib/components/ExportButton/exporter.tsx
index f4a5ed9a1517..ce1e61703da4 100644
--- a/frontend/src/lib/components/ExportButton/exporter.tsx
+++ b/frontend/src/lib/components/ExportButton/exporter.tsx
@@ -10,7 +10,12 @@ export function downloadBlob(content: Blob, filename: string): void {
anchor.download = filename
document.body.appendChild(anchor)
anchor.click()
- window.URL.revokeObjectURL(objectURL)
+ // Firefox can cancel the download if the anchor is removed (or the URL revoked) synchronously
+ // after click() — defer both, matching downloadFile in lib/utils/dom.ts.
+ setTimeout(() => {
+ document.body.removeChild(anchor)
+ window.URL.revokeObjectURL(objectURL)
+ }, 0)
}
export async function exportedAssetBlob(asset: ExportedAssetType): Promise<Blob> {