The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): shares into T3 Code start in the last project (#38850)
Julius Marminge committed
Nov 18, 2026 at 19:41 UTC
899a2433ab83ce97ba0413d8ed3c2950a4099fa6
3 files changed
+47
-2
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+5
@@ -98,6 +98,7 @@ import { newTaskFlowKey } from "./new-task-flow-state";
98
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
99
import { ConnectionStatusDot } from "../connection/ConnectionStatusDot";
100
import { appAtomRegistry } from "../../state/atom-registry";
101
+import { mobilePreferencesAtom } from "../../state/preferences";
102
103
import { readEnvironmentScope, useEnvironmentScope } from "../../state/session";
104
@@ -473,6 +474,8 @@ export function NewTaskDraftScreen(props: {
474
return;
475
}
476
477
+ const preferences = appAtomRegistry.get(mobilePreferencesAtom);
478
+ const saved = AsyncResult.isSuccess(preferences) ? preferences.value : undefined;
479
const selection = resolveDraftProjectSelection(
480
selectedProjectKey,
481
projects,
@@ -480,6 +483,8 @@ export function NewTaskDraftScreen(props: {
483
{
484
incomingShareId: props.incomingShareId,
485
pickerClosed: initialPickerRef.current === "open" && isFocused,
486
+ useLastProject: saved?.useLastProjectForNewThreads,
487
+ lastProject: saved?.lastThreadProject,
488
},
489
);
490
if (selection.kind === "preserve") {
apps/mobile/src/features/threads/new-task-project-selection.test.ts
+24
@@ -200,6 +200,30 @@ describe("resolveDraftProjectSelection", () => {
200
}),
201
).toEqual({ kind: "pick" });
202
});
203
+
204
+ it("starts a share draft in the last project when Use last project is on", () => {
205
+ const scopes = [makeScope([projects[0]!]), makeScope([projects[1]!])];
206
+ const shareDraft = {
207
+ incomingShareId: "share",
208
+ pickerClosed: false,
209
+ useLastProject: undefined,
210
+ lastProject: { environmentId: "environment", projectId: "t3code-2" },
211
+ };
212
+ expect(resolveDraftProjectSelection(null, projects, scopes, shareDraft)).toEqual({
213
+ kind: "select",
214
+ project: projects[1],
215
+ });
216
+ expect(
217
+ resolveDraftProjectSelection(null, projects, scopes, {
218
+ ...shareDraft,
219
+ useLastProject: false,
220
+ }),
221
+ ).toEqual({ kind: "pick" });
222
+ const archived = [projects[0]!, { ...projects[1]!, archivedAt: "2026-07-02T00:00:00.000Z" }];
223
+ expect(resolveDraftProjectSelection(null, archived, scopes, shareDraft)).toEqual({
224
+ kind: "pick",
225
+ });
226
+ });
227
});
228
229
describe("newTaskDestination", () => {
apps/mobile/src/features/threads/new-task-project-selection.ts
+18
-2
@@ -138,6 +138,8 @@ export function resolveDraftProjectSelection(
138
readonly incomingShareId: string | undefined;
139
/** The draft's first project picker closed and the draft is showing again. */
140
readonly pickerClosed: boolean;
141
+ readonly useLastProject?: boolean | undefined;
142
+ readonly lastProject?: ProjectRef | undefined;
143
},
144
): DraftProjectSelectionResolution {
145
const hasExplicitProjectSelection =
@@ -153,8 +155,22 @@ export function resolveDraftProjectSelection(
155
return { kind: "dismiss" };
156
}
157
156
- const onlyScope =
157
- draft.incomingShareId !== undefined && projectScopes.length === 1 ? projectScopes[0] : null;
158
+ if (draft.incomingShareId === undefined) {
159
+ return { kind: "pick" };
160
+ }
161
+ const last =
162
+ draft.useLastProject === false
163
+ ? undefined
164
+ : projects.find(
165
+ (project) =>
166
+ project.environmentId === draft.lastProject?.environmentId &&
167
+ project.id === draft.lastProject.projectId &&
168
+ project.archivedAt == null,
169
+ );
170
+ if (last) {
171
+ return { kind: "select", project: last };
172
+ }
173
+ const onlyScope = projectScopes.length === 1 ? projectScopes[0] : null;
174
return onlyScope ? { kind: "select", project: onlyScope.representative } : { kind: "pick" };
175
}
176