fix: delay ObjectURL revocation to prevent failed downloads#622
Open
hobostay wants to merge 1 commit intoheygen-com:mainfrom
Open
fix: delay ObjectURL revocation to prevent failed downloads#622hobostay wants to merge 1 commit intoheygen-com:mainfrom
hobostay wants to merge 1 commit intoheygen-com:mainfrom
Conversation
…oads setTimeout(..., 0) revokes the blob URL on the next microtask, before the browser has initiated the download triggered by link.click(). This causes empty or failed downloads for frame captures. Use a 1-second delay to ensure the download starts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
jrusso1020
approved these changes
May 5, 2026
Collaborator
jrusso1020
left a comment
There was a problem hiding this comment.
Real race — setTimeout(..., 0) queues the revoke as a macrotask that can fire before the browser kicks off the navigation triggered by link.click(), especially on slower devices. 1000ms is a safe upper bound for download initiation. LGTM.
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.
Summary
URL.revokeObjectURLfrom 0ms to 1000ms in frame capture downloadsetTimeout(..., 0)revokes the blob URL before the browser initiates the download, causing empty/failed downloadsDetails
Affected file:
packages/studio/src/App.tsx(line 875)When capturing a frame, the code creates a blob URL, triggers a download via
link.click(), then immediately schedulesrevokeObjectURLwithsetTimeout(..., 0). The 0ms timeout fires on the next microtask, before the browser has started reading from the blob, resulting in a failed or empty download.Test plan
🤖 Generated with Claude Code