Skip to content

Commit 55fa95c

Browse files
fix(mobile): a draft waiting for its environment selects no project
While a route draft's stamped environment is still loading, the provider fell back to the first loaded environment's first project, so the composer showed, and Start could send to, a project the user never chose. A pending route draft now has no selected project, which keeps the screen on its existing empty state until the draft opens. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 722ce0d commit 55fa95c

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,16 @@ export function NewTaskFlowProvider(
310310
Arr.filter((project) => project.environmentId === selectedEnvironmentId),
311311
);
312312

313+
// A route draft still waiting for its environment has no project yet: the
314+
// fallback would show, and could send to, another environment's project.
313315
const selectedProject =
314-
projectsForEnvironment.find(
315-
(project) => scopedProjectKey(project.environmentId, project.id) === selectedProjectKey,
316-
) ??
317-
projectsForEnvironment[0] ??
318-
null;
316+
routeDraftResolution.kind === "pending"
317+
? null
318+
: (projectsForEnvironment.find(
319+
(project) => scopedProjectKey(project.environmentId, project.id) === selectedProjectKey,
320+
) ??
321+
projectsForEnvironment[0] ??
322+
null);
319323

320324
const projectDefaults = useNewTaskProjectDefaults(selectedProject);
321325
const selectedEnvironmentServerConfig = projectDefaults.serverConfig;

0 commit comments

Comments
 (0)