The best way to control Claude Code, Codex and more from any computer or phone
perf(web): the project scans hook compiles without manual memoization (#20606)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 22:02 UTC
41f56d96d8e6dc92129ef156f6a8372510d410db
1 file changed
+13
-17
apps/web/src/onboarding/useProjectScans.ts
+13
-17
@@ -2,29 +2,25 @@ import { RegistryContext, useAtomValue } from "@effect/atom-react";
2
import type { EnvironmentId } from "@t3tools/contracts";
3
import * as Option from "effect/Option";
4
import { AsyncResult, Atom } from "effect/reactivity";
5
-import { useContext, useMemo } from "react";
5
+import { useContext } from "react";
6
7
import { agentSessionScan } from "../state/agentSessions";
8
import { formatEnvironmentQueryError } from "../state/query";
9
10
export function useProjectScans(environmentIds: readonly EnvironmentId[]) {
11
const registry = useContext(RegistryContext);
12
- const scansAtom = useMemo(
13
- () =>
14
- Atom.make((get) =>
15
- environmentIds.map((environmentId) => {
16
- const atom = agentSessionScan({ environmentId, input: {} });
17
- const result = get(atom);
18
- return {
19
- environmentId,
20
- data: Option.getOrNull(AsyncResult.value(result)),
21
- error: result._tag === "Failure" ? formatEnvironmentQueryError(result.cause) : null,
22
- isPending: result.waiting || result._tag === "Initial",
23
- refresh: () => registry.refresh(atom),
24
- };
25
- }),
26
- ),
27
- [environmentIds, registry],
12
+ const scansAtom = Atom.make((get) =>
13
+ environmentIds.map((environmentId) => {
14
+ const atom = agentSessionScan({ environmentId, input: {} });
15
+ const result = get(atom);
16
+ return {
17
+ environmentId,
18
+ data: Option.getOrNull(AsyncResult.value(result)),
19
+ error: result._tag === "Failure" ? formatEnvironmentQueryError(result.cause) : null,
20
+ isPending: result.waiting || result._tag === "Initial",
21
+ refresh: () => registry.refresh(atom),
22
+ };
23
+ }),
24
);
25
return useAtomValue(scansAtom);
26
}