fix(composer): address image-editor follow-up nits on #1491#1565
Merged
Conversation
Follow-ups from the #1491 review: - fetch_media_bytes now replies with tauri::ipc::Response so image bytes cross IPC as a raw buffer instead of a JSON number array (~3x smaller to serialize at the 50 MiB cap). TS wrapper reads an ArrayBuffer and the e2e mock returns the same shape. - Escape no longer exits canvas edit mode while a save upload is in flight: the editor reports its saving state up, and the lightbox's Escape handler ignores the key mid-save so a dismissal can't look like a cancel while the attachment swap still lands. - Documented the in-memory-only revert map as an explicit non-goal for draft round-trips, per the review's recorded-decision ask. Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
When an attachment is spoilered, the lightbox toggle now swaps its circular pill for the shared button rounded-lg shape with a 2px white ring, so the active/selected state is obvious at a glance. Idle look and toggle behavior are unchanged. Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
The previous data-[state=on] classes never applied in the real build: the TooltipTrigger wrapping the Toggle clobbers Radix's data-state attribute. Gate the active classes on isSpoilered instead, and strengthen the treatment (solid white ring-2 + white/25 fill on the shared rounded-lg shape) so the selected state is obvious against the dark lightbox backdrop. Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
wesbillman
approved these changes
Jul 7, 2026
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.
Category: improvement
User Impact: Image annotation opens faster for large uploads and behaves more consistently if a save is already in progress.
Problem: Follow-up review on #1491 called out a few sharp edges in composer image editing: fetched image bytes were serialized as JSON arrays, Escape could look like cancel while a save still completed, and the revert affordance’s draft behavior needed an explicit scope decision.
Solution: Return fetched image bytes over Tauri IPC as a raw buffer, gate Escape while the editor is saving, and document the in-memory-only revert behavior as the intended follow-up boundary.
File changes
desktop/src-tauri/src/commands/media_download.rs
Returns image-editor media bytes as
tauri::ipc::Responseso large images cross IPC as raw bytes instead of JSON number arrays while preserving existing validation and size caps.desktop/src/features/messages/lib/useMediaUpload.ts
Documents the revert-originals map as intentionally in-memory-only, recording draft round-trip persistence as outside this follow-up’s scope.
desktop/src/features/messages/ui/ComposerAttachments.tsx
Tracks the image editor’s save state in the lightbox and prevents Escape from leaving edit mode while a save upload is in flight.
desktop/src/features/messages/ui/ComposerImageEditor.tsx
Reports save-in-flight state to the parent and clears that signal on unmount so the lightbox Escape guard stays accurate.
desktop/src/shared/api/tauriMedia.ts
Reads
fetch_media_bytesresponses as anArrayBufferand wraps them in aUint8Arrayfor the editor.desktop/src/testing/e2eBridge.ts
Updates the E2E mock for
fetch_media_bytesto return the same rawArrayBuffershape as the Tauri command.Reproduction Steps
Validation
770c71efis in progress with no failures observed yet.770c71efwith independent screenshot verification.biome check ., file-sizes, px-text, tsc,pnpm test1885/1885, desktop-tauri fmt-check, andcargo checkpassed; local clippy findings were pre-existing outside this PR.Screenshots / Mocks
Coordination
buzz://message?channel=99a4d0c9-e02b-49e3-aa81-e637c4fd0292&thread=790c65884f4b236b88f23b9c7a82dd904d4113a8822bc1c8df3c4f7896896ff8