Skip to content

Commit 01f894e

Browse files
authored
fix(mobile): back from an agent's thread returns to its parent (#15068)
1 parent ad5178a commit 01f894e

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎apps/mobile/src/features/threads/thread-subagent-group.tsx‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useAtomValue } from "@effect/atom-react";
2-
import { useIsFocused, useNavigation } from "@react-navigation/native";
2+
import { StackActions, useIsFocused, useNavigation } from "@react-navigation/native";
33
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
44
import { summarizeSubagentStatuses } from "@t3tools/client-runtime/state/subagent-display";
55
import { isActiveSubagentStatus } from "@t3tools/client-runtime/state/subagentRuntime";
@@ -158,11 +158,15 @@ export function ThreadSubagentGroup(props: {
158158
}
159159
disabled={threadId === null}
160160
onPress={() => {
161+
// Push, not navigate: navigate reuses this Thread route, so back
162+
// would skip the parent thread.
161163
if (threadId !== null)
162-
navigation.navigate("Thread", {
163-
environmentId: String(props.environmentId),
164-
threadId: String(threadId),
165-
});
164+
navigation.dispatch(
165+
StackActions.push("Thread", {
166+
environmentId: String(props.environmentId),
167+
threadId: String(threadId),
168+
}),
169+
);
166170
}}
167171
className="rounded-lg px-3 py-3 active:bg-subtle"
168172
>

0 commit comments

Comments
 (0)