Skip to content

Commit ea4f43e

Browse files
perf(web): the environment hooks compile without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit ea4f43e

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

‎apps/web/src/state/environments.ts‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
import { Discovery } from "@t3tools/client-runtime/relay";
88
import type { EnvironmentId } from "@t3tools/contracts";
99
import * as Option from "effect/Option";
10-
import { useMemo } from "react";
1110

1211
import { environmentCatalog } from "../connection/catalog";
1312
import {
@@ -44,12 +43,8 @@ export function useEnvironments() {
4443
const networkStatus = useAtomValue(environmentCatalog.networkStatusValueAtom);
4544
const presentationById = useAtomValue(environmentPresentations.presentationsAtom);
4645

47-
const environments = useMemo(
48-
() =>
49-
[...presentationById.entries()].map(([environmentId, presentation]) =>
50-
projectEnvironmentPresentation(environmentId, presentation),
51-
),
52-
[presentationById],
46+
const environments = [...presentationById.entries()].map(([environmentId, presentation]) =>
47+
projectEnvironmentPresentation(environmentId, presentation),
5348
);
5449

5550
return {
@@ -68,13 +63,9 @@ export function useEnvironment(
6863
environmentId: EnvironmentId | null,
6964
): EnvironmentPresentation | null {
7065
const { presentation } = useEnvironmentPresentation(environmentId);
71-
return useMemo(
72-
() =>
73-
environmentId === null || presentation === null
74-
? null
75-
: projectEnvironmentPresentation(environmentId, presentation),
76-
[environmentId, presentation],
77-
);
66+
return environmentId === null || presentation === null
67+
? null
68+
: projectEnvironmentPresentation(environmentId, presentation);
7869
}
7970

8071
export function usePrimaryEnvironment(): EnvironmentPresentation | null {

0 commit comments

Comments
 (0)