TypeScript
perf(web): the provider update notification compiles without manual memoization (#20609)
Julius Marminge196950a6e9c1
diff --git a/apps/web/src/components/ProviderUpdatePrimaryNotification.tsx b/apps/web/src/components/ProviderUpdatePrimaryNotification.tsxindex 5516b4a1ba4..74040e171c5 100644--- a/apps/web/src/components/ProviderUpdatePrimaryNotification.tsx+++ b/apps/web/src/components/ProviderUpdatePrimaryNotification.tsx@@ -1,7 +1,7 @@import { useNavigate } from "@tanstack/react-router";import { useAtomValue } from "@effect/atom-react";import { DownloadIcon } from "lucide-react";-import { useCallback, useEffect, useMemo, useRef } from "react";+import { useEffect, useRef } from "react";import {AuthProvidersManageScope,type ServerProvider,@@ -126,36 +126,27 @@ export function ProviderUpdatePrimaryNotification() {};}, []);- const updateProviders = useMemo(() => collectProviderUpdateCandidates(providers), [providers]);- const notificationKey = useMemo(- () => providerUpdateNotificationKey(updateProviders),- [updateProviders],- );- const oneClickProviders = useMemo(- () =>- updateProviders.filter((provider) => canOneClickUpdateProviderCandidate(provider, providers)),- [providers, updateProviders],+ const updateProviders = collectProviderUpdateCandidates(providers);+ const notificationKey = providerUpdateNotificationKey(updateProviders);+ const oneClickProviders = updateProviders.filter((provider) =>+ canOneClickUpdateProviderCandidate(provider, providers),);- const openProviderSettings = useCallback(- (toastId?: ProviderUpdateToastId) => {- const activeToast = activeToastRef.current;- if (toastId !== undefined) {- toastManager.close(toastId);- } else if (activeToast?.kind === "prompt") {- toastManager.close(activeToast.toastId);- }- if (- activeToast &&- (toastId === undefined ||- (activeToast.kind === "prompt" && activeToast.toastId === toastId))- ) {- activeToastRef.current = null;- }- void navigate({ to: "/settings/providers" });- },- [navigate],- );+ const openProviderSettings = (toastId?: ProviderUpdateToastId) => {+ const activeToast = activeToastRef.current;+ if (toastId !== undefined) {+ toastManager.close(toastId);+ } else if (activeToast?.kind === "prompt") {+ toastManager.close(activeToast.toastId);+ }+ if (+ activeToast &&+ (toastId === undefined || (activeToast.kind === "prompt" && activeToast.toastId === toastId))+ ) {+ activeToastRef.current = null;+ }+ void navigate({ to: "/settings/providers" });+ };useEffect(() => {const activeToast = activeToastRef.current;