|
1 | 1 | import { useNavigate } from "@tanstack/react-router"; |
2 | 2 | import { useAtomValue } from "@effect/atom-react"; |
3 | 3 | import { DownloadIcon } from "lucide-react"; |
4 | | -import { useCallback, useEffect, useMemo, useRef } from "react"; |
| 4 | +import { useEffect, useRef } from "react"; |
5 | 5 | import { |
6 | 6 | AuthProvidersManageScope, |
7 | 7 | type ServerProvider, |
@@ -126,36 +126,27 @@ export function ProviderUpdatePrimaryNotification() { |
126 | 126 | }; |
127 | 127 | }, []); |
128 | 128 |
|
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), |
138 | 133 | ); |
139 | 134 |
|
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 | + }; |
159 | 150 |
|
160 | 151 | useEffect(() => { |
161 | 152 | const activeToast = activeToastRef.current; |
|
0 commit comments