Skip to content

Commit 8a46150

Browse files
perf(web): the project scans hook compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit 8a46150

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

‎apps/web/src/onboarding/useProjectScans.ts‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,25 @@ import { RegistryContext, useAtomValue } from "@effect/atom-react";
22
import type { EnvironmentId } from "@t3tools/contracts";
33
import * as Option from "effect/Option";
44
import { AsyncResult, Atom } from "effect/reactivity";
5-
import { useContext, useMemo } from "react";
5+
import { useContext } from "react";
66

77
import { agentSessionScan } from "../state/agentSessions";
88
import { formatEnvironmentQueryError } from "../state/query";
99

1010
export function useProjectScans(environmentIds: readonly EnvironmentId[]) {
1111
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+
}),
2824
);
2925
return useAtomValue(scansAtom);
3026
}

0 commit comments

Comments
 (0)