Skip to content
TypeScript

fix(mobile): back from an agent's thread returns to its parent (#15068)

AKolenda01f894e23e03
diff --git a/apps/mobile/src/features/threads/thread-subagent-group.tsx b/apps/mobile/src/features/threads/thread-subagent-group.tsx
index c0f1adf4736..aacc2c07353 100644
--- a/apps/mobile/src/features/threads/thread-subagent-group.tsx
+++ b/apps/mobile/src/features/threads/thread-subagent-group.tsx
@@ -1,5 +1,5 @@
import { useAtomValue } from "@effect/atom-react";
-import { useIsFocused, useNavigation } from "@react-navigation/native";
+import { StackActions, useIsFocused, useNavigation } from "@react-navigation/native";
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import { summarizeSubagentStatuses } from "@t3tools/client-runtime/state/subagent-display";
import { isActiveSubagentStatus } from "@t3tools/client-runtime/state/subagentRuntime";
@@ -158,11 +158,15 @@ export function ThreadSubagentGroup(props: {
}
disabled={threadId === null}
onPress={() => {
+ // Push, not navigate: navigate reuses this Thread route, so back
+ // would skip the parent thread.
if (threadId !== null)
- navigation.navigate("Thread", {
- environmentId: String(props.environmentId),
- threadId: String(threadId),
- });
+ navigation.dispatch(
+ StackActions.push("Thread", {
+ environmentId: String(props.environmentId),
+ threadId: String(threadId),
+ }),
+ );
}}
className="rounded-lg px-3 py-3 active:bg-subtle"
>