Skip to content

Commit ca8155c

Browse files
perf(web): the server update banner compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit ca8155c

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

‎apps/web/src/components/chat/useAutoBalanceUpdateBanner.tsx‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useAtomValue } from "@effect/atom-react";
22
import type { ServerUpdateState } from "@t3tools/client-runtime/state/server";
33
import { Atom } from "effect/reactivity";
4-
import { useMemo, useState } from "react";
4+
import { useState } from "react";
55

66
import type { EnvironmentPresentation } from "~/state/environments";
77
import { serverEnvironment } from "~/state/server";
@@ -29,15 +29,11 @@ import { ComposerServerUpdateIcon } from "./ComposerServerUpdateStatus";
2929
export function useAutoBalanceUpdateBanner(
3030
environments: readonly EnvironmentPresentation[],
3131
): ComposerBannerStackItem | null {
32-
const statesAtom = useMemo(
33-
() =>
34-
Atom.make((get) =>
35-
environments.map((environment) => ({
36-
environment,
37-
state: get(serverEnvironment.updateStateAtom(environment.environmentId)),
38-
})),
39-
),
40-
[environments],
32+
const statesAtom = Atom.make((get) =>
33+
environments.map((environment) => ({
34+
environment,
35+
state: get(serverEnvironment.updateStateAtom(environment.environmentId)),
36+
})),
4137
);
4238
const states = useAtomValue(statesAtom);
4339
const [dismissedNotices, setDismissedNotices] = useState<ReadonlySet<string | ServerUpdateState>>(

0 commit comments

Comments
 (0)