Skip to content

Commit 5ba0143

Browse files
committed
fix(mobile): gate queued follow-ups on attachment uploads
Review follow-ups on the media chain. onSendMessage grew an upload block guard from #8978 but onQueueFollowUp did not, and upstream has no onQueueFollowUp to carry the change. Both UI entry points gate on canSend today, so this is currently unreachable — but a future caller would queue a follow-up mid-upload and start a second transfer of the same bytes alongside the background worker's. The collapsed queue pill also hardcoded its accessibility label while its send sibling and the toolbar button both surface the block reason, so a failed upload disabled the pill with nothing for VoiceOver to read.
1 parent 1a8f1dc commit 5ba0143

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

apps/mobile/src/features/threads/ThreadComposer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1797,7 +1797,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
17971797
/>
17981798
{canQueueFollowUp ? (
17991799
<ControlPill
1800-
accessibilityLabel="Queue follow-up"
1800+
accessibilityLabel={attachmentBlockReason ?? "Queue follow-up"}
18011801
icon="arrow.up"
18021802
variant="primary"
18031803
disabled={!canSend || isMutatingSessionInputQueue}

apps/mobile/src/state/use-thread-composer-state.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,21 @@ export function useThreadComposerState() {
776776
const attachments = draft.attachments;
777777
if (text.length === 0 && attachments.length === 0) return null;
778778

779+
// Same gate onSendMessage applies: queueing while an upload is still in
780+
// flight would start a second transfer of the same bytes alongside the
781+
// background worker's.
782+
if (
783+
composerAttachmentUploadBlockReason({
784+
environmentId: selectedThreadShell.environmentId,
785+
attachments,
786+
connected: selectedEnvironmentRuntime?.connectionState === "connected",
787+
serverConfig: selectedEnvironmentRuntime?.serverConfig ?? null,
788+
states: appAtomRegistry.get(composerAttachmentUploadsAtom),
789+
}) !== null
790+
) {
791+
return null;
792+
}
793+
779794
if (attachments.length > PROVIDER_SEND_TURN_MAX_ATTACHMENTS) {
780795
Alert.alert(
781796
"Too many attachments",

0 commit comments

Comments
 (0)