Skip to content

Commit 42c489c

Browse files
committed
fix(mobile): back from an agent's thread returns to its parent
Opening an agent from the thread feed called navigate("Thread"), which reuses the current Thread route and swaps its params, so the parent left the stack and back went straight to Home. Push the agent's thread instead.
1 parent db51460 commit 42c489c

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 {
@@ -175,11 +175,15 @@ export function ThreadSubagentGroup(props: {
175175
}
176176
disabled={threadId === null}
177177
onPress={() => {
178+
// Push, not navigate: navigate reuses this Thread route, so back
179+
// would skip the parent thread.
178180
if (threadId !== null)
179-
navigation.navigate("Thread", {
180-
environmentId: String(props.environmentId),
181-
threadId: String(threadId),
182-
});
181+
navigation.dispatch(
182+
StackActions.push("Thread", {
183+
environmentId: String(props.environmentId),
184+
threadId: String(threadId),
185+
}),
186+
);
183187
}}
184188
className="min-h-14 flex-row items-center gap-3 rounded-lg px-2 py-2 active:bg-subtle"
185189
>

0 commit comments

Comments
 (0)