@devries-cameron20 / t3code-1 / commits / c976a09df0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

feat(mobile): add a "Use last project" preference for new threads (#24741)

Co-authored-by: none23 <n.anisimov.23@gmail.com> Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Alex committed Oct 27, 2026 at 00:36 UTC c976a09df0c8ae738a7018182aee4f713e94a1eb
11 files changed +285 -76
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+20 -17
@@ -523,24 +523,27 @@ function AdaptiveWorkspaceLayoutContent(
523 : undefined;
524 const first = (value: string | string[] | undefined) =>
525 Array.isArray(value) ? value[0] : value;
526 - const thread = appAtomRegistry
527 - .get(environmentThreadShells.navigationThreadShellsAtom)
528 - .find(
529 - (candidate) =>
530 - candidate.environmentId === first(params?.environmentId) &&
531 - candidate.id === first(params?.threadId),
532 - );
533 - const draft = params?.draft;
534 - const draftEnvironmentId = first(draft?.environmentId);
535 - const draftProjectId = first(draft?.projectId);
536 - const currentProject = thread
537 - ? { environmentId: thread.environmentId, id: thread.projectId }
538 - : projects.find(
539 - (project) =>
540 - project.environmentId === draftEnvironmentId && project.id === draftProjectId,
541 - );
526 + const environmentId = first(params?.environmentId);
527 + const threadId = first(params?.threadId);
528 + // The full index, not the sidebar list: subagent and archived threads are current threads too.
529 + const projectId =
530 + environmentId && threadId
531 + ? appAtomRegistry
532 + .get(
533 + environmentThreadShells.environmentThreadIndexAtom(EnvironmentId.make(environmentId)),
534 + )
535 + .get(ThreadId.make(threadId))?.projectId
536 + : undefined;
537 + const preferences = appAtomRegistry.get(mobilePreferencesAtom);
538 + const saved = AsyncResult.isSuccess(preferences) ? preferences.value : undefined;
539 handleSelectThreadRoute(
543 - newTaskDestination(layout.usesSplitView, projects, currentProject, uuidv4()),
540 + newTaskDestination({
541 + projects,
542 + requestId: uuidv4(),
543 + useLastProject: saved?.useLastProjectForNewThreads,
544 + currentProject: environmentId && projectId ? { environmentId, projectId } : undefined,
545 + lastProject: saved?.lastThreadProject,
546 + }),
547 );
548 };
549
apps/mobile/src/features/settings/SettingsProjectGroupingRouteScreen.tsx
+2 -1
@@ -12,7 +12,7 @@ import {
12 import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
13 import { SettingsChoiceRow } from "./components/SettingsChoiceRow";
14 import { SettingsSection } from "./components/SettingsSection";
15 -import { WorkingSectionSettings } from "./ThreadSettingsSections";
15 +import { NewThreadSettingsSection, WorkingSectionSettings } from "./ThreadSettingsSections";
16
17 const GROUPING_OPTIONS: ReadonlyArray<{
18 readonly mode: SidebarProjectGroupingMode;
@@ -68,6 +68,7 @@ export function SettingsProjectGroupingRouteScreen() {
68 ))}
69 </SettingsSection>
70 <WorkingSectionSettings />
71 + <NewThreadSettingsSection />
72 </ScrollView>
73 </SettingsScreen>
74 );
apps/mobile/src/features/settings/ThreadSettingsSections.tsx
+19
@@ -195,6 +195,25 @@ export function WorkingSectionSettings() {
195 );
196 }
197
198 +export function NewThreadSettingsSection() {
199 + const savePreferences = useAtomSet(updateMobilePreferencesAtom);
200 + const preferences = useAtomValue(mobilePreferencesAtom);
201 + const useLastProject =
202 + AsyncResult.isSuccess(preferences) && preferences.value.useLastProjectForNewThreads !== false;
203 +
204 + return (
205 + <SettingsSection title="New threads">
206 + <SettingsSwitchRow
207 + icon="square.and.pencil"
208 + label="Use last project"
209 + subtitle="Start new threads in the last project you used on this device."
210 + value={useLastProject}
211 + onValueChange={(value) => savePreferences({ useLastProjectForNewThreads: value })}
212 + />
213 + </SettingsSection>
214 + );
215 +}
216 +
217 function LegacySettingsSection() {
218 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
219 const preferences = useAtomValue(mobilePreferencesAtom);
apps/mobile/src/features/settings/settings-search.ts
+2
@@ -38,6 +38,8 @@ const SETTINGS_SEARCH_TERMS = {
38 "organization",
39 "sidebar",
40 "working section",
41 + "new threads",
42 + "last project",
43 ],
44 SettingsThreads: [
45 "new threads",
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+29 -3
@@ -8,6 +8,8 @@ import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavi
8 import { submittedThreadParams } from "./thread-route-state";
9 import { ThreadScreenBinding, ThreadScreenFallback } from "./ThreadScreenHost";
10 import { draftThreadShell } from "./draft-thread-shell";
11 +import { useRememberThreadProject } from "./useRememberThreadProject";
12 +import { scopedProjectKey } from "../../lib/scopedEntities";
13 import { connectionTone } from "../connection/connectionTone";
14 import { AppBar } from "../../components/ui/AppBar";
15 import { ThreadId } from "@t3tools/contracts";
@@ -20,6 +22,7 @@ import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime
22 import {
23 CommonActions,
24 StackActions,
25 + useIsFocused,
26 useNavigation,
27 usePreventRemove,
28 } from "@react-navigation/native";
@@ -156,6 +159,7 @@ export function NewTaskDraftScreen(props: {
159 const projects = useProjects();
160 const flow = useNewTaskFlow();
161 const navigation = useNavigation();
162 + const isFocused = useIsFocused();
163 const goBack = useWorkspaceBackNavigation("threads");
164 const {
165 consumeShare,
@@ -165,6 +169,13 @@ export function NewTaskDraftScreen(props: {
169 reserveShare,
170 } = useIncomingShare();
171 const { projectScopes, selectedProject, selectedProjectKey, setProject } = flow;
172 + // selectedProject falls back to the environment's first project; remember only a chosen one.
173 + useRememberThreadProject(
174 + selectedProject &&
175 + selectedProjectKey === scopedProjectKey(selectedProject.environmentId, selectedProject.id)
176 + ? selectedProject
177 + : null,
178 + );
179 const selectedProjectLabel = (() => {
180 if (!selectedProject) return null;
181 const scope = projectScopes.find((candidate) =>
@@ -416,6 +427,7 @@ export function NewTaskDraftScreen(props: {
427 }, [navigation, openDraft, projects, props.draftId]);
428
429 const lastInitialProjectRefRef = useRef(props.initialProjectRef);
430 + const initialPickerRef = useRef<"open" | "dismissed" | null>(null);
431
432 useEffect(() => {
433 if (props.draftId) {
@@ -477,22 +489,36 @@ export function NewTaskDraftScreen(props: {
489 return;
490 }
491
480 - const selection = resolveDraftProjectSelection(selectedProjectKey, projects, projectScopes);
492 + const selection = resolveDraftProjectSelection(selectedProjectKey, projects, projectScopes, {
493 + incomingShareId: props.incomingShareId,
494 + pickerClosed: initialPickerRef.current === "open" && isFocused,
495 + });
496 if (selection.kind === "preserve") {
497 + initialPickerRef.current = null;
498 return;
499 }
500 if (selection.kind === "select") {
501 setProject(selection.project);
502 return;
503 }
488 -
504 + if (selection.kind === "dismiss") {
505 + initialPickerRef.current = "dismissed";
506 + goBack();
507 + return;
508 + }
509 + // Open the first picker once; catalog updates must not push it again over a cancelled draft.
510 + if (initialPickerRef.current !== null) {
511 + return;
512 + }
513 + initialPickerRef.current = "open";
514 navigation.dispatch(CommonActions.navigate("NewTaskProject"));
515 }, [
516 + goBack,
517 + isFocused,
518 projectScopes,
519 projects,
520 flow.draftKey,
521 props.initialProjectRef,
495 - // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Opening a draft from a share or draft id re-resolves its project.
522 props.incomingShareId,
523 props.draftId,
524 navigation,
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+11 -6
@@ -1,4 +1,5 @@
1 import * as Dialog from "../../components/ui/Dialog";
2 +import { useRememberThreadProject } from "./useRememberThreadProject";
3 import { useOpenPullRequest } from "../../native/useOpenPullRequest";
4 import { makeTurnCommandMetadata } from "../../lib/commandMetadata";
5 import { buildProjectThreadStartTurnInput } from "../../lib/projectThreadStartTurn";
@@ -81,7 +82,6 @@ import { resolveLatestMergeBackRun } from "@t3tools/client-runtime/state/thread-
82 import { threadEnvironment, useThreadFamily } from "../../state/threads";
83 import { EMPTY_ENVIRONMENT_THREAD_STATE } from "@t3tools/client-runtime/state/threads";
84 import { useProjects } from "../../state/entities";
84 -import { newTaskDestination } from "./new-task-project-selection";
85 import { projectThreadContentPresentation } from "./threadContentPresentation";
86 import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
87 import {
@@ -198,14 +198,18 @@ function ThreadUnavailableScreen(props: {
198 function UnavailableThreadDraftRedirect(props: { readonly environmentId: EnvironmentId }) {
199 const navigation = useNavigation();
200 const projects = useProjects();
201 - const { layout } = useAdaptiveWorkspaceLayout();
201 const openDraft = useEffectEvent(() => {
202 const project = projects.find((candidate) => candidate.environmentId === props.environmentId);
203 navigation.dispatch(
205 - StackActions.replace(
206 - "Thread",
207 - newTaskDestination(layout.usesSplitView, projects, project, uuidv4()),
208 - ),
204 + StackActions.replace("Thread", {
205 + draft: project
206 + ? {
207 + requestId: uuidv4(),
208 + environmentId: String(project.environmentId),
209 + projectId: String(project.id),
210 + }
211 + : { requestId: uuidv4() },
212 + }),
213 );
214 });
215 // oxlint-disable-next-line t3code/react-effect-budget -- replaces this route in the navigator
@@ -339,6 +343,7 @@ function ThreadRouteContent(
343 selectedThreadProject,
344 selectedEnvironmentConnection,
345 } = useThreadSelection();
346 + useRememberThreadProject(selectedThreadProject);
347 const canOperateThread = useEnvironmentScope(
348 selectedThread?.environmentId ?? null,
349 AuthOrchestrationOperateScope,
apps/mobile/src/features/threads/new-task-project-selection.test.ts
+117 -26
@@ -95,46 +95,137 @@ describe("resolveEnvironmentProjectMatch", () => {
95 });
96
97 describe("resolveDraftProjectSelection", () => {
98 - it("selects one logical project even when it has multiple physical workspaces", () => {
99 - const projects = [makeProject("t3code"), makeProject("t3code-2"), makeProject("t3code-3")];
100 - expect(resolveDraftProjectSelection(null, projects, [makeScope(projects)])).toEqual({
101 - kind: "select",
102 - project: projects[0],
98 + const projects = [makeProject("t3code"), makeProject("t3code-2")];
99 + const draft = { incomingShareId: undefined, pickerClosed: false };
100 +
101 + it("opens the picker instead of auto-selecting the only project", () => {
102 + expect(resolveDraftProjectSelection(null, projects, [makeScope(projects)], draft)).toEqual({
103 + kind: "pick",
104 });
105 });
106
106 - it("does not preserve a project key that is missing from the catalog", () => {
107 - const project = makeProject("t3code");
107 + it("selects the only logical project for shared content", () => {
108 expect(
109 - resolveDraftProjectSelection("environment:removed", [project], [makeScope([project])]),
110 - ).toEqual({
111 - kind: "select",
112 - project,
113 - });
109 + resolveDraftProjectSelection(null, projects, [makeScope(projects)], {
110 + ...draft,
111 + incomingShareId: "share",
112 + }),
113 + ).toEqual({ kind: "select", project: projects[0] });
114 + });
115 +
116 + it("dismisses the draft when the first picker closes without a choice", () => {
117 + expect(
118 + resolveDraftProjectSelection(null, projects, [makeScope(projects)], {
119 + ...draft,
120 + pickerClosed: true,
121 + }),
122 + ).toEqual({ kind: "dismiss" });
123 + });
124 +
125 + it("keeps the draft when the picker closes after a choice", () => {
126 + expect(
127 + resolveDraftProjectSelection("environment:t3code-2", projects, [makeScope(projects)], {
128 + ...draft,
129 + pickerClosed: true,
130 + }),
131 + ).toEqual({ kind: "preserve" });
132 + });
133 +
134 + it("keeps a share draft asking for a project when its picker closes without a choice", () => {
135 + const scopes = [makeScope([projects[0]!]), makeScope([projects[1]!])];
136 + expect(
137 + resolveDraftProjectSelection(null, projects, scopes, {
138 + incomingShareId: "share",
139 + pickerClosed: true,
140 + }),
141 + ).toEqual({ kind: "pick" });
142 });
143 });
144
145 describe("newTaskDestination", () => {
118 - it("opens the current thread's project directly in split view", () => {
119 - const projects = [makeProject("first"), makeProject("current", "other-environment")];
120 - expect(newTaskDestination(true, projects, projects[1], "request")).toEqual({
146 + const picker = { draft: { requestId: "request" } };
147 +
148 + function destination(options: {
149 + readonly useLastProject: boolean | undefined;
150 + readonly projects: ReadonlyArray<EnvironmentProject>;
151 + readonly current?: EnvironmentProject;
152 + readonly last?: { readonly environmentId: string; readonly projectId: string };
153 + }) {
154 + return newTaskDestination({
155 + projects: options.projects,
156 + requestId: "request",
157 + useLastProject: options.useLastProject,
158 + currentProject: options.current && {
159 + environmentId: options.current.environmentId,
160 + projectId: options.current.id,
161 + },
162 + lastProject: options.last,
163 + });
164 + }
165 +
166 + it("starts in the current thread's project ahead of the remembered one", () => {
167 + const projects = [makeProject("remembered"), makeProject("current", "other-environment")];
168 + expect(
169 + destination({
170 + useLastProject: true,
171 + projects,
172 + current: projects[1],
173 + last: { environmentId: "environment", projectId: "remembered" },
174 + }),
175 + ).toEqual({
176 draft: { requestId: "request", environmentId: "other-environment", projectId: "current" },
177 });
178 });
124 - it("uses an available project when split view has no current project", () => {
125 - expect(newTaskDestination(true, [makeProject("first")], undefined, "request")).toEqual({
126 - draft: { requestId: "request", environmentId: "environment", projectId: "first" },
179 +
180 + it("treats an unset preference as on", () => {
181 + const projects = [makeProject("first"), makeProject("current")];
182 + expect(destination({ useLastProject: undefined, projects, current: projects[1] })).toEqual({
183 + draft: { requestId: "request", environmentId: "environment", projectId: "current" },
184 });
185 });
129 - it("keeps the picker when there are no projects", () => {
130 - expect(newTaskDestination(true, [], undefined, "request")).toEqual({
131 - draft: { requestId: "request" },
186 +
187 + it("starts in the remembered project of its own environment when there is no current one", () => {
188 + const projects = [makeProject("chosen"), makeProject("chosen", "other-environment")];
189 + expect(
190 + destination({
191 + useLastProject: true,
192 + projects,
193 + last: { environmentId: "other-environment", projectId: "chosen" },
194 + }),
195 + ).toEqual({
196 + draft: { requestId: "request", environmentId: "other-environment", projectId: "chosen" },
197 });
198 });
134 - it("opens the same draft route in compact view", () => {
135 - const project = makeProject("current");
136 - expect(newTaskDestination(false, [project], project, "request")).toEqual({
137 - draft: { requestId: "request", environmentId: "environment", projectId: "current" },
138 - });
199 +
200 + it("ignores a remembered project id from another environment", () => {
201 + expect(
202 + destination({
203 + useLastProject: true,
204 + projects: [makeProject("chosen")],
205 + last: { environmentId: "removed-environment", projectId: "chosen" },
206 + }),
207 + ).toEqual(picker);
208 + });
209 +
210 + it("opens the picker rather than the first project when nothing matches", () => {
211 + expect(
212 + destination({
213 + useLastProject: true,
214 + projects: [makeProject("first"), makeProject("second")],
215 + current: makeProject("removed"),
216 + }),
217 + ).toEqual(picker);
218 + });
219 +
220 + it("always opens the picker when the preference is off", () => {
221 + const only = makeProject("only");
222 + expect(
223 + destination({
224 + useLastProject: false,
225 + projects: [only],
226 + current: only,
227 + last: { environmentId: "environment", projectId: "only" },
228 + }),
229 + ).toEqual(picker);
230 });
231 });
apps/mobile/src/features/threads/new-task-project-selection.ts
+33 -23
@@ -7,7 +7,8 @@ import type { HomeProjectScope } from "../home/homeThreadList";
7 type DraftProjectSelectionResolution =
8 | { readonly kind: "preserve" }
9 | { readonly kind: "select"; readonly project: EnvironmentProject }
10 - | { readonly kind: "pick" };
10 + | { readonly kind: "pick" }
11 + | { readonly kind: "dismiss" };
12
13 export function getProjectScopeSelectionTarget(
14 scope: HomeProjectScope,
@@ -36,13 +37,6 @@ export function filterProjectScopes(
37 );
38 }
39
39 -function getOnlySelectableProject(
40 - projectScopes: ReadonlyArray<HomeProjectScope>,
41 -): EnvironmentProject | null {
42 - const onlyScope = projectScopes.length === 1 ? projectScopes[0] : null;
43 - return onlyScope?.representative ?? null;
44 -}
45 -
40 export function resolveEnvironmentProjectMatch(
41 projectsOnTarget: ReadonlyArray<EnvironmentProject>,
42 selectedProject: EnvironmentProject | null,
@@ -89,6 +83,11 @@ export function resolveDraftProjectSelection(
83 selectedProjectKey: string | null,
84 projects: ReadonlyArray<EnvironmentProject>,
85 projectScopes: ReadonlyArray<HomeProjectScope>,
86 + draft: {
87 + readonly incomingShareId: string | undefined;
88 + /** The draft's first project picker closed and the draft is showing again. */
89 + readonly pickerClosed: boolean;
90 + },
91 ): DraftProjectSelectionResolution {
92 const hasExplicitProjectSelection =
93 selectedProjectKey !== null &&
@@ -98,30 +97,41 @@ export function resolveDraftProjectSelection(
97 if (hasExplicitProjectSelection) {
98 return { kind: "preserve" };
99 }
100 + // A share draft holds content the user sent here, so cancelling the picker must not drop it.
101 + if (draft.pickerClosed && selectedProjectKey === null && draft.incomingShareId === undefined) {
102 + return { kind: "dismiss" };
103 + }
104
102 - const onlyProject = getOnlySelectableProject(projectScopes);
103 - return onlyProject ? { kind: "select", project: onlyProject } : { kind: "pick" };
105 + const onlyScope =
106 + draft.incomingShareId !== undefined && projectScopes.length === 1 ? projectScopes[0] : null;
107 + return onlyScope ? { kind: "select", project: onlyScope.representative } : { kind: "pick" };
108 }
109
106 -export function newTaskDestination(
107 - _usesSplitView: boolean,
108 - projects: ReadonlyArray<EnvironmentProject>,
109 - currentProject: Pick<EnvironmentProject, "environmentId" | "id"> | undefined,
110 - requestId: string,
111 -) {
110 +type ProjectRef = { readonly environmentId: string; readonly projectId: string };
111 +
112 +export function newTaskDestination(options: {
113 + readonly projects: ReadonlyArray<EnvironmentProject>;
114 + readonly requestId: string;
115 + readonly useLastProject: boolean | undefined;
116 + readonly currentProject: ProjectRef | undefined;
117 + readonly lastProject: ProjectRef | undefined;
118 +}) {
119 + const find = (ref: ProjectRef | undefined) =>
120 + ref &&
121 + options.projects.find(
122 + (project) => project.environmentId === ref.environmentId && project.id === ref.projectId,
123 + );
124 const project =
113 - projects.find(
114 - (candidate) =>
115 - candidate.environmentId === currentProject?.environmentId &&
116 - candidate.id === currentProject.id,
117 - ) ?? projects[0];
125 + options.useLastProject === false
126 + ? undefined
127 + : (find(options.currentProject) ?? find(options.lastProject));
128 return project
129 ? {
130 draft: {
121 - requestId,
131 + requestId: options.requestId,
132 environmentId: String(project.environmentId),
133 projectId: String(project.id),
134 },
135 }
126 - : { draft: { requestId } };
136 + : { draft: { requestId: options.requestId } };
137 }
apps/mobile/src/features/threads/useRememberThreadProject.ts new
+32
@@ -0,0 +1,32 @@
1 +import { useAtomSet } from "@effect/atom-react";
2 +import { useFocusEffect } from "@react-navigation/native";
3 +import { isScratchProject } from "@t3tools/client-runtime/state/projects";
4 +import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
5 +import { AsyncResult } from "effect/reactivity";
6 +import { useCallback } from "react";
7 +
8 +import { appAtomRegistry } from "../../state/atom-registry";
9 +import { useEnvironmentServerConfig } from "../../state/entities";
10 +import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
11 +
12 +export function useRememberThreadProject(project: EnvironmentProject | null) {
13 + const savePreferences = useAtomSet(updateMobilePreferencesAtom);
14 + const serverConfig = useEnvironmentServerConfig(project?.environmentId ?? null);
15 + const environmentId = project?.environmentId;
16 + const projectId = project?.id;
17 + const remember =
18 + project !== null &&
19 + serverConfig !== null &&
20 + !isScratchProject(project, serverConfig.scratchWorkspaceRoot);
21 +
22 + useFocusEffect(
23 + useCallback(() => {
24 + if (!remember || !environmentId || !projectId) return;
25 + const preferences = appAtomRegistry.get(mobilePreferencesAtom);
26 + if (!AsyncResult.isSuccess(preferences)) return;
27 + const last = preferences.value.lastThreadProject;
28 + if (last?.environmentId === environmentId && last.projectId === projectId) return;
29 + savePreferences({ lastThreadProject: { environmentId, projectId } });
30 + }, [environmentId, projectId, remember, savePreferences]),
31 + );
32 +}
apps/mobile/src/persistence/mobile-preferences.ts
+15
@@ -79,6 +79,11 @@ export type WorkspaceSelections = typeof WorkspaceSelections.Type;
79 const isThreadListFilters = Schema.is(ThreadListFilters);
80 const isWorkspaceSelections = Schema.is(WorkspaceSelections);
81 const isPullRequestListPreferences = Schema.is(PullRequestListPreferences);
82 +const ThreadProject = Schema.Struct({
83 + environmentId: Schema.NonEmptyString,
84 + projectId: Schema.NonEmptyString,
85 +});
86 +const isThreadProject = Schema.is(ThreadProject);
87
88 export interface Preferences {
89 readonly navigationTabOrder?: readonly string[];
@@ -107,6 +112,8 @@ export interface Preferences {
112 readonly projectGroupingMode?: SidebarProjectGroupingMode;
113 readonly planModeEnabled?: boolean;
114 readonly workingShelfEnabled?: boolean;
115 + readonly useLastProjectForNewThreads?: boolean;
116 + readonly lastThreadProject?: typeof ThreadProject.Type;
117 readonly modelFavorites?: ReadonlyArray<{
118 readonly provider: ProviderInstanceId;
119 readonly model: string;
@@ -183,6 +190,8 @@ function sanitizePreferences(parsed: Preferences): Preferences {
190 projectGroupingMode?: SidebarProjectGroupingMode;
191 planModeEnabled?: boolean;
192 workingShelfEnabled?: boolean;
193 + useLastProjectForNewThreads?: boolean;
194 + lastThreadProject?: typeof ThreadProject.Type;
195 modelFavorites?: Preferences["modelFavorites"];
196 threadListSettledShelfExpanded?: boolean;
197 threadListSnoozedShelfExpanded?: boolean;
@@ -303,6 +312,12 @@ function sanitizePreferences(parsed: Preferences): Preferences {
312 if (typeof parsed.workingShelfEnabled === "boolean") {
313 preferences.workingShelfEnabled = parsed.workingShelfEnabled;
314 }
315 + if (typeof parsed.useLastProjectForNewThreads === "boolean") {
316 + preferences.useLastProjectForNewThreads = parsed.useLastProjectForNewThreads;
317 + }
318 + if (isThreadProject(parsed.lastThreadProject)) {
319 + preferences.lastThreadProject = parsed.lastThreadProject;
320 + }
321 if (Array.isArray(parsed.modelFavorites)) {
322 preferences.modelFavorites = parsed.modelFavorites.filter(
323 (favorite) =>
docs/user/thread-sidebar.md
+5
@@ -10,6 +10,11 @@ and mode selections, unless the destination project has its own model default.
10 Its branch and workspace mode come from your configured defaults. To continue in
11 an existing worktree, use **New thread in this worktree** from the branch toolbar.
12
13 +On mobile, **New thread** starts in the current thread's project, or else in the
14 +last project you opened or chose on that device. If neither is available, the
15 +project picker opens. Turn off **Settings → General → Use last project** to
16 +choose a project every time.
17 +
18 When you change a new thread's project, T3 Code stays in the current environment
19 if that project exists there. Otherwise it selects an environment that has it.
20