Fix broken image flash on bridge-managed uploads#1072
Open
mbarta wants to merge 2 commits into
Open
Conversation
Bridge-managed uploads (uploadUrl is null) hand Lexxy a placeholder File with no real image bytes, so URL.createObjectURL produced a blob: URL pointing at empty content that rendered as a broken image until the server URL was swapped in. Gate the local previewSrc on uploadUrl, the same signal createDOM already uses, so the img points straight at the server URL instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
I think we'd be better off with |
Member
Author
Thanks @samuelpecher, are you happy to take over? I can give it a go using Claude but it'd still require a review from a web developer. |
The local DirectUpload and bridge-managed upload paths had diverged at three behavioral points keyed on `uploadUrl != null` (preview source, file-vs-image figure, whether to run DirectUpload). Make the split explicit via a subclass: - `ActionTextAttachmentUploadNode` now owns the local DirectUpload behavior and exposes two hooks (`canPreviewFileLocally`, `$buildPreviewSrcForBlob`) plus a non-private `$startUploadIfNeeded`. - `ManagedAttachmentUploadNode` extends it and overrides those hooks for the bridge case: no local preview, no DirectUpload. The bridge factory (`Contents#insertPendingAttachment`) creates the managed subclass; the local factory still creates the base. The mutation listener is registered for both so the uploads-busy validity counter still catches bridge uploads. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
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.
Bridge-managed uploads (
uploadUrlis null) hand Lexxy a placeholderFilewith no real image bytes.$showUploadedAttachmentstill built apreviewSrcfrom it viaURL.createObjectURL, producing ablob:URL pointing at empty content that rendered as a broken image until#preloadAndSwapSrcswapped in the server URL.Gate the local preview on
uploadUrl != null— the same signalcreateDOMalready uses — so bridge-materialized images point straight at the server URL instead of a broken blob.