Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): new threads no longer get stuck on Starting #15870

Mergednekohasekai(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/15870/headmerged by juliusmarminge View on GitHub

Showing 7 changed files with 28 additions and 16 deletions (loading 4).

x
0 of 7 viewed, 7 left
11 additions and 2 deletionsapps/mobile/src/features/threads/ThreadAgentsSheet.tsxModified
View file
@@ -9,6 +9,7 @@
import { deriveSubagentElapsedMs, formatDuration } from "@t3tools/shared/orchestrationTiming";
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
import * as DateTime from "effect/DateTime";
+import { Atom } from "effect/reactivity";
import * as Haptics from "expo-haptics";
import { useEffect, useState } from "react";
import { Platform, Pressable, ScrollView, View } from "react-native";
@@ -28,8 +29,16 @@
​
type AgentsTarget = { readonly environmentId: EnvironmentId; readonly threadId: ThreadId };
​
-export function useThreadTurnSubagents(target: AgentsTarget): ThreadTurnSubagents | null {
- return useAtomValue(environmentThreadDetails.turnSubagentsAtom(target));
+const EMPTY_TURN_SUBAGENTS_ATOM = Atom.make<ThreadTurnSubagents | null>(null).pipe(
+ Atom.withLabel("mobile-thread-turn-subagents:empty"),
+);
+​
+export function useThreadTurnSubagents(target: AgentsTarget | null): ThreadTurnSubagents | null {
+ return useAtomValue(
+ target === null
+ ? EMPTY_TURN_SUBAGENTS_ATOM
+ : environmentThreadDetails.turnSubagentsAtom(target),
+ );
​
export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {