Skip to content

Commit 8294961

Browse files
saphidclaude
andcommitted
fix(mobile): forget the sent model when a new-task draft screen goes
If the draft screen is removed before its closing navigation runs, the surviving sheet's next draft no longer shows or sends the previous task's model. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 19c6f59 commit 8294961

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,11 @@ export function NewTaskDraftScreen(props: {
558558
});
559559
return () => cancelAnimationFrame(frame);
560560
}, [navigation, preventRemove, submitNavigationAction]);
561+
// The sent model stands in only while this draft leaves. If the screen goes
562+
// before its closing navigation runs, the sheet's next draft resolves its
563+
// model normally.
564+
const { setSubmittedModelSelection } = flow;
565+
useEffect(() => () => setSubmittedModelSelection(null), [setSubmittedModelSelection]);
561566
const hasImportedIncomingShare = Boolean(
562567
props.incomingShareId &&
563568
(consumedIncomingShareIdRef.current === props.incomingShareId ||

‎apps/mobile/src/features/threads/new-task-flow-provider.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ type NewTaskFlowContextValue = {
248248
readonly removeAttachment: (imageId: string) => void;
249249
readonly clearAttachments: () => void;
250250
readonly setSubmitting: (value: boolean) => void;
251-
readonly setSubmittedModelSelection: (value: ModelSelection) => void;
251+
readonly setSubmittedModelSelection: (value: ModelSelection | null) => void;
252252
readonly setBranchQuery: (value: string) => void;
253253
readonly loadBranches: () => void;
254254
readonly loadMoreBranches: () => void;

0 commit comments

Comments
 (0)