Skip to content

Commit b8f5416

Browse files
t3dotggclaude
andcommitted
fix(mobile): New thread also finds the project of a failed or just-delivered creation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 42a5e31 commit b8f5416

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

‎apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ import { appAtomRegistry } from "../../state/atom-registry";
4747
import { activeNewTaskProjectKeyAtom } from "../../state/active-new-task";
4848
import { useProjects } from "../../state/entities";
4949
import { environmentServerConfigsAtom } from "../../state/server";
50+
import {
51+
pendingThreadCreationOutcomesAtom,
52+
selectThreadCreationDetail,
53+
} from "../../state/pending-thread-creation";
5054
import { threadOutboxManager } from "../../state/thread-outbox";
5155
import { workspaceConnections } from "../../state/workspace";
5256
import { environmentThreadShells } from "../../state/threads";
@@ -533,21 +537,25 @@ function AdaptiveWorkspaceLayoutContent(
533537
const environmentId = first(params?.environmentId);
534538
const threadId = first(params?.threadId);
535539
// The index includes subagent threads, which the navigation list leaves out. A thread whose
536-
// creation is still queued is not indexed yet, so its queued creation names the project.
540+
// creation is queued or failed is not indexed, so its pending creation names the project.
537541
const threadProjectId = (() => {
538542
if (!environmentId || !threadId) return undefined;
539543
const ref = {
540544
environmentId: EnvironmentId.make(environmentId),
541545
threadId: ThreadId.make(threadId),
542546
};
543-
const queued = appAtomRegistry.get(threadOutboxManager.queuedMessagesByThreadKeyAtom);
547+
const { pendingCreation } = selectThreadCreationDetail({
548+
threadRef: ref,
549+
threadKey: scopedThreadKey(ref.environmentId, ref.threadId),
550+
queuedMessagesByThreadKey: appAtomRegistry.get(
551+
threadOutboxManager.queuedMessagesByThreadKeyAtom,
552+
),
553+
outcomes: appAtomRegistry.get(pendingThreadCreationOutcomesAtom),
554+
});
544555
return (
545556
appAtomRegistry
546557
.get(environmentThreadShells.environmentThreadIndexAtom(ref.environmentId))
547-
.get(ref.threadId)?.projectId ??
548-
queued[scopedThreadKey(ref.environmentId, ref.threadId)]?.find(
549-
(message) => message.creation,
550-
)?.creation?.projectId
558+
.get(ref.threadId)?.projectId ?? pendingCreation?.message.creation?.projectId
551559
);
552560
})();
553561
// An open draft's route may not name the project it shows, so read the draft's selection.

0 commit comments

Comments
 (0)