Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): leave idle subagent chains out of the shell for clients that read them on demand #29129

Closedfireboltdude1357(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/29129/headopened View on GitHub

Showing 15 changed files with 73 additions and 16 deletions (loading 12).

x
0 of 15 viewed, 15 left
10 additions and 2 deletionsapps/mobile/src/state/use-thread-selection.tsModified
View file
@@ -1,6 +1,6 @@
import { useAtomValue } from "@effect/atom-react";
import { useRoute, type RouteProp } from "@react-navigation/native";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import {
EnvironmentId,
ThreadId,
@@ -21,7 +21,8 @@
​
import { scopedThreadKey } from "../lib/scopedEntities";
import { useProject, useQuietThreadShell } from "./entities";
-import { useEnvironmentThread } from "./threads";
+import { threadFamilies, useEnvironmentThread } from "./threads";
+import { appAtomRegistry } from "./atom-registry";
import {
resolvePendingThreadCreation,
pendingThreadCreationOutcomesAtom,
@@ -139,6 +140,13 @@
threadId: ThreadId.make(routeThreadId),
: lastRouteThreadRef;
+ const familyEnvironmentId = selectedThreadRef?.environmentId;
+ const familyThreadId = selectedThreadRef?.threadId;
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps the viewed thread's omitted family rows mounted until navigation
+ useEffect(() => {
+ if (familyEnvironmentId === undefined || familyThreadId === undefined) return;
+ return threadFamilies.mount(appAtomRegistry, familyEnvironmentId, familyThreadId);
+ }, [familyEnvironmentId, familyThreadId]);