Skip to content

Commit 8e42569

Browse files
refactor(mobile): drop the redundant draft id from the pickProject resolution
AI-assisted; verified with the tests and tools listed above.
1 parent 648c314 commit 8e42569

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎apps/mobile/src/features/threads/new-task-flow-state.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe("resolveRouteDraft", () => {
118118
it("asks for a project for the same draft when its project is gone", () => {
119119
expect(
120120
resolveRouteDraft({ ...base, projects: [{ environmentId, id: ProjectId.make("other") }] }),
121-
).toEqual({ kind: "pickProject", draftId: "new-task:draft-1" });
121+
).toEqual({ kind: "pickProject" });
122122
});
123123
});
124124

‎apps/mobile/src/features/threads/new-task-flow-state.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type RouteDraftResolution =
7676
| { readonly kind: "pending" }
7777
| { readonly kind: "missing" }
7878
/** The draft survives but its project is gone: pick another for it. */
79-
| { readonly kind: "pickProject"; readonly draftId: string }
79+
| { readonly kind: "pickProject" }
8080
| { readonly kind: "open"; readonly flow: NewTaskFlowState };
8181

8282
export function resolveRouteDraft(input: {
@@ -103,11 +103,8 @@ export function resolveRouteDraft(input: {
103103
const loaded = input.projects.some(
104104
(project) => project.environmentId === stamp.environmentId && project.id === stamp.projectId,
105105
);
106-
if (!loaded) {
107-
return input.stampedEnvironmentLoading
108-
? { kind: "pending" }
109-
: { kind: "pickProject", draftId: routeDraftId };
110-
}
106+
if (!loaded)
107+
return input.stampedEnvironmentLoading ? { kind: "pending" } : { kind: "pickProject" };
111108
return {
112109
kind: "open",
113110
flow: {

0 commit comments

Comments
 (0)