Skip to content

[Bug]: iOS paste of camera-roll photos shows nothing while they prepare, so repeated pastes attach duplicates #41068

Closed

Description

@bdamokos

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

  1. On an iPhone (T3 Code 2.3.0), copy 5 full-size photos from the camera roll.
  2. Open an existing thread and long-press in the composer, then tap Paste.
  3. Nothing seems to happen, so tap Paste again, a few times.
  4. Wait for the photos to appear, then send.

Expected behavior

  • Tapping Paste hands the photos to the app right away. The paste menu goes away, as it does in other apps, and a placeholder thumbnail appears for each photo while it is prepared in the background.
  • The composer stays responsive while the photos prepare. A send during that time waits for them (this part already works).
  • Pasting the same photos again does not add copies.

Actual behavior

  • After tapping Paste, the iOS paste menu stays on screen and nothing appears in the composer for a long time, so it looks as if the paste did not happen.
  • Each repeated paste adds another full set of the same photos. Once they all finish, the draft holds several copies.
  • Sending then fails with "Images can total up to 80 MiB per message or question response."

The host is not involved: photos are converted on the phone and uploaded only on send.

Impact

Major degradation or frequent failure

Version or commit

iOS app 2.3.0. Same code on main at dbb5bdb582.

Environment

Native iOS app on iPhone, connected to a T3 Code server on a Mac.

Logs or stack traces

None. The problem is in the code paths below.

Screenshots, recordings, or supporting files

No response

Workaround

Paste once and wait for the thumbnails, even if nothing seems to happen. Remove any duplicates before sending.

Code pointers

  • No progress shown: apps/mobile/src/features/threads/ThreadComposer.tsx:905 counts pending image pastes in a ref that nothing renders. The draft gets no placeholder until convertPastedImagesToAttachments (apps/mobile/src/lib/composerImages.ts:654) has converted every photo, one at a time. Each photo is read into JS as base64, resized, and re-encoded to JPEG when it is too large.
  • Slow native handoff: T3ComposerEditorView.loadImages (apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift) decodes each provider to a UIImage and writes it out with pngData(). A full-size camera photo becomes a very large PNG, which then has to be re-encoded to JPEG.
  • Paste menu stays open: paste(_:) returns at once and loads the images asynchronously, but nothing in the composer changes, so the menu stays up. This is how it looked on the device; I have not confirmed why the menu stays.
  • Repeats not caught: isSameAttachment (apps/mobile/src/state/use-composer-drafts.ts:1429) treats two images as the same only if their fileUri matches. Each paste saves to a new file named pasted-image.jpeg, so the same photo pasted twice never matches. Web compares image contents ([Bug]: Composer silently drops different images with matching metadata #37115 / fix(web): keep distinct images with matching attachment metadata #37116).
  • Send error: the 80 MiB total image limit in getProviderAttachmentLimitError (packages/contracts/src/chatAttachment.ts:222).

Suggested direction

Show placeholder thumbnails as soon as you paste, as web does. Catch repeats by comparing image contents. Keep the expensive conversion off the main and JS threads, for example by encoding to JPEG on the native side instead of PNG.

Found with the in-app triage playbook. Automated comment from a coding agent. claude-opus-5-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions