Skip to content

Commit 449f033

Browse files
perf(web): the provider update notification compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 70d60e0 commit 449f033

2 files changed

Lines changed: 21 additions & 29 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,5 @@ export const REACT_COMPILED_FILES = [
9696
"apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx",
9797
"apps/web/src/components/ThreadTerminalDrawer.tsx",
9898
"apps/web/src/components/settings/SettingsPanels.tsx",
99+
"apps/web/src/components/ProviderUpdatePrimaryNotification.tsx",
99100
] as const;

‎apps/web/src/components/ProviderUpdatePrimaryNotification.tsx‎

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useNavigate } from "@tanstack/react-router";
22
import { useAtomValue } from "@effect/atom-react";
33
import { DownloadIcon } from "lucide-react";
4-
import { useCallback, useEffect, useMemo, useRef } from "react";
4+
import { useEffect, useRef } from "react";
55
import {
66
AuthProvidersManageScope,
77
type ServerProvider,
@@ -126,36 +126,27 @@ export function ProviderUpdatePrimaryNotification() {
126126
};
127127
}, []);
128128

129-
const updateProviders = useMemo(() => collectProviderUpdateCandidates(providers), [providers]);
130-
const notificationKey = useMemo(
131-
() => providerUpdateNotificationKey(updateProviders),
132-
[updateProviders],
133-
);
134-
const oneClickProviders = useMemo(
135-
() =>
136-
updateProviders.filter((provider) => canOneClickUpdateProviderCandidate(provider, providers)),
137-
[providers, updateProviders],
129+
const updateProviders = collectProviderUpdateCandidates(providers);
130+
const notificationKey = providerUpdateNotificationKey(updateProviders);
131+
const oneClickProviders = updateProviders.filter((provider) =>
132+
canOneClickUpdateProviderCandidate(provider, providers),
138133
);
139134

140-
const openProviderSettings = useCallback(
141-
(toastId?: ProviderUpdateToastId) => {
142-
const activeToast = activeToastRef.current;
143-
if (toastId !== undefined) {
144-
toastManager.close(toastId);
145-
} else if (activeToast?.kind === "prompt") {
146-
toastManager.close(activeToast.toastId);
147-
}
148-
if (
149-
activeToast &&
150-
(toastId === undefined ||
151-
(activeToast.kind === "prompt" && activeToast.toastId === toastId))
152-
) {
153-
activeToastRef.current = null;
154-
}
155-
void navigate({ to: "/settings/providers" });
156-
},
157-
[navigate],
158-
);
135+
const openProviderSettings = (toastId?: ProviderUpdateToastId) => {
136+
const activeToast = activeToastRef.current;
137+
if (toastId !== undefined) {
138+
toastManager.close(toastId);
139+
} else if (activeToast?.kind === "prompt") {
140+
toastManager.close(activeToast.toastId);
141+
}
142+
if (
143+
activeToast &&
144+
(toastId === undefined || (activeToast.kind === "prompt" && activeToast.toastId === toastId))
145+
) {
146+
activeToastRef.current = null;
147+
}
148+
void navigate({ to: "/settings/providers" });
149+
};
159150

160151
useEffect(() => {
161152
const activeToast = activeToastRef.current;

0 commit comments

Comments
 (0)