Skip to content

Commit b348bde

Browse files
committed
fix(mobile): keep the composer's draft and typing after answering a question
1 parent 4d73e1d commit b348bde

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ export interface ThreadComposerProps {
184184
readonly followUpBehavior: FollowUpBehavior;
185185
/** Whether the live turn can actually be steered by this provider. */
186186
readonly canSteerActiveTurn: boolean;
187+
/** A question or failure card owns the slot; iOS destroys the hidden editor, so it remounts. */
188+
readonly hidden: boolean;
187189
readonly editorRef?: RefObject<ComposerEditorHandle | null>;
188190
readonly onChangeDraftMessage: (value: string) => void;
189191
readonly onPickDraftMedia: () => Promise<void>;
@@ -917,6 +919,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
917919
layout={COMPOSER_LAYOUT_TRANSITION}
918920
>
919921
<ComposerEditor
922+
key={props.hidden ? "hidden" : "visible"}
920923
draftKey={composerDraftKey}
921924
environmentId={props.environmentId}
922925
onOpenMention={(path) => {

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
13901390
</View>
13911391

13921392
{/* Hidden (not unmounted) while a user-input request owns the
1393-
composer slot, so composer drafts and editor state survive.
1393+
composer slot, so the composer's state survives.
13941394
A rejected creation has no thread to send to; the failure card
13951395
owns the slot instead. */}
13961396
<View style={composerSlotHidden ? { display: "none" } : undefined}>
@@ -1460,6 +1460,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
14601460
draftKey={props.composerDraftKey ?? undefined}
14611461
followUpBehavior={props.followUpBehavior}
14621462
canSteerActiveTurn={props.canSteerActiveTurn}
1463+
hidden={composerSlotHidden}
14631464
queuedEdit={
14641465
props.queuedRunEdit === null
14651466
? null

0 commit comments

Comments
 (0)