The best way to control Claude Code, Codex and more from any computer or phone
perf(web): the session scope hooks compile without manual memoization (#20610)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 22:01 UTC
97a9ca11d224f43701f9fdcffe29444a4f7536db
1 file changed
+10
-15
apps/web/src/state/session.ts
+10
-15
@@ -6,7 +6,6 @@ import {
6
type EnvironmentId,
7
sessionGrantsScope,
8
} from "@t3tools/contracts";
9
-import { useMemo } from "react";
9
import * as Option from "effect/Option";
10
import { AsyncResult, Atom } from "effect/reactivity";
11
@@ -41,20 +40,16 @@ export function useEnvironmentsWithScope(
40
environments: ReadonlyArray<{ readonly environmentId: EnvironmentId }>,
41
scope: AuthEnvironmentScope,
42
): ReadonlySet<EnvironmentId> {
44
- const permitted = useMemo(
45
- () =>
46
- Atom.make((get) => {
47
- const ids = new Set<EnvironmentId>();
48
- for (const { environmentId } of environments) {
49
- const result = get(environmentSession.sessionStateAtom(environmentId));
50
- if (sessionHasScope(result, scope)) {
51
- ids.add(environmentId);
52
- }
53
- }
54
- return ids;
55
- }),
56
- [environments, scope],
57
- );
43
+ const permitted = Atom.make((get) => {
44
+ const ids = new Set<EnvironmentId>();
45
+ for (const { environmentId } of environments) {
46
+ const result = get(environmentSession.sessionStateAtom(environmentId));
47
+ if (sessionHasScope(result, scope)) {
48
+ ids.add(environmentId);
49
+ }
50
+ }
51
+ return ids;
52
+ });
53
return useAtomValue(permitted);
54
}
55