The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 15:15 UTC
fix(web): remove duplicate provider update progress (#7761)
Naveed Iqbal committed
Aug 23, 2026 at 05:16 UTC
4e169df1dd12e0ed960dcb310e9460897759a55e
3 files changed
+49
-47
apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.ts
+16
@@ -31,6 +31,7 @@ import {
31
parseWslDistroFromInstanceId,
32
providerUpdateNotificationKey,
33
resolveEnvironmentUpdateRowStatus,
34
+ shouldShowPrimaryProviderUpdateToast,
35
type LocalEnvironmentProvidersInput,
36
type LocalEnvironmentUpdateGroup,
37
type LocalProviderUpdateOutcome,
@@ -325,6 +326,21 @@ describe("provider update launch notification logic", () => {
326
type: "loading",
327
title: "Updating provider",
328
});
329
+ expect(shouldShowPrimaryProviderUpdateToast(view)).toBe(false);
330
+ });
331
+
332
+ it("keeps the initial prompt and terminal outcomes visible as toasts", () => {
333
+ expect(
334
+ shouldShowPrimaryProviderUpdateToast(
335
+ getProviderUpdateInitialToastView({
336
+ updateProviders: [updateCandidate({ driver: driver("codex") })],
337
+ oneClickProviders: [updateCandidate({ driver: driver("codex") })],
338
+ }),
339
+ ),
340
+ ).toBe(true);
341
+ expect(
342
+ shouldShowPrimaryProviderUpdateToast(getProviderUpdateRejectedToastView(1, "boom")),
343
+ ).toBe(true);
344
});
345
346
it("uses server failure state for failed progress", () => {
apps/web/src/components/ProviderUpdateLaunchNotification.logic.ts
+4
@@ -231,6 +231,10 @@ export function getProviderUpdateInitialToastView(input: {
231
};
232
}
233
234
+export function shouldShowPrimaryProviderUpdateToast(view: ProviderUpdateToastView): boolean {
235
+ return view.phase !== "running";
236
+}
237
+
238
export function getProviderUpdateRunningToastView(providerCount: number): ProviderUpdateToastView {
239
return {
240
phase: "running",
apps/web/src/components/ProviderUpdatePrimaryNotification.tsx
+29
-47
@@ -16,8 +16,8 @@ import {
16
getProviderUpdateInitialToastView,
17
getProviderUpdateProgressToastView,
18
getProviderUpdateRejectedToastView,
19
- getProviderUpdateRunningToastView,
19
providerUpdateNotificationKey,
20
+ shouldShowPrimaryProviderUpdateToast,
21
type ProviderUpdateToastView,
22
} from "./ProviderUpdateLaunchNotification.logic";
23
import { hiddenToastActionProps, stackedThreadToast, toastManager } from "./ui/toast";
@@ -31,7 +31,6 @@ type ActiveProviderUpdateToast =
31
| {
32
readonly kind: "update";
33
readonly key: string;
34
- readonly toastId: ProviderUpdateToastId;
34
readonly providerInstanceIds: ReadonlySet<ProviderInstanceId>;
35
readonly providerCount: number;
36
};
@@ -57,20 +56,16 @@ function ProviderUpdateToastIcon({ provider }: { provider: ProviderDriverKind })
56
);
57
}
58
60
-function updateProviderUpdateToast(input: {
61
- readonly toastId: ProviderUpdateToastId;
59
+function addProviderUpdateToast(input: {
60
readonly view: ProviderUpdateToastView;
63
- readonly openSettings: () => void;
61
+ readonly openSettings: (toastId: ProviderUpdateToastId) => void;
62
}) {
63
if (input.view.type === "loading" || input.view.type === "success") {
66
- toastManager.update(input.toastId, {
64
+ return toastManager.add({
65
type: input.view.type,
66
title: input.view.title,
67
description: input.view.description,
68
timeout: 0,
71
- // Base UI merges toast updates and omits `undefined` keys, so `undefined`
72
- // would leave the prompt's Update button in place. Replace it with a
73
- // defined empty action so the CTA cannot linger while the update runs.
69
actionProps: hiddenToastActionProps,
70
data: {
71
hideCopyButton: true,
@@ -79,11 +74,10 @@ function updateProviderUpdateToast(input: {
74
: {}),
75
},
76
});
82
- return;
77
}
78
85
- toastManager.update(
86
- input.toastId,
79
+ let toastId!: ProviderUpdateToastId;
80
+ toastId = toastManager.add(
81
stackedThreadToast({
82
type: input.view.type,
83
title: input.view.title,
@@ -91,7 +85,7 @@ function updateProviderUpdateToast(input: {
85
timeout: 0,
86
actionProps: {
87
children: "Settings",
94
- onClick: input.openSettings,
88
+ onClick: () => input.openSettings(toastId),
89
},
90
actionVariant: "outline",
91
data: {
@@ -99,10 +93,7 @@ function updateProviderUpdateToast(input: {
93
},
94
}),
95
);
102
-}
103
-
104
-function isTerminalProviderUpdateToastView(view: ProviderUpdateToastView) {
105
- return view.phase === "failed" || view.phase === "unchanged" || view.phase === "succeeded";
96
+ return toastId;
97
}
98
99
/**
@@ -126,10 +117,10 @@ export function ProviderUpdatePrimaryNotification() {
117
useEffect(() => {
118
return () => {
119
const activeToast = activeToastRef.current;
129
- if (activeToast) {
120
+ if (activeToast?.kind === "prompt") {
121
toastManager.close(activeToast.toastId);
131
- activeToastRef.current = null;
122
}
123
+ activeToastRef.current = null;
124
};
125
}, []);
126
@@ -149,10 +140,14 @@ export function ProviderUpdatePrimaryNotification() {
140
const activeToast = activeToastRef.current;
141
if (toastId !== undefined) {
142
toastManager.close(toastId);
152
- } else if (activeToast) {
143
+ } else if (activeToast?.kind === "prompt") {
144
toastManager.close(activeToast.toastId);
145
}
155
- if (activeToast && (toastId === undefined || activeToast.toastId === toastId)) {
146
+ if (
147
+ activeToast &&
148
+ (toastId === undefined ||
149
+ (activeToast.kind === "prompt" && activeToast.toastId === toastId))
150
+ ) {
151
activeToastRef.current = null;
152
}
153
void navigate({ to: "/settings/providers" });
@@ -173,15 +168,12 @@ export function ProviderUpdatePrimaryNotification() {
168
providers: activeProviders,
169
providerCount: activeToast.providerCount,
170
});
176
- updateProviderUpdateToast({
177
- toastId: activeToast.toastId,
178
- view,
179
- openSettings: () => openProviderSettings(activeToast.toastId),
180
- });
181
-
182
- if (isTerminalProviderUpdateToastView(view)) {
183
- activeToastRef.current = null;
171
+ if (!shouldShowPrimaryProviderUpdateToast(view)) {
172
+ return;
173
}
174
+
175
+ addProviderUpdateToast({ view, openSettings: openProviderSettings });
176
+ activeToastRef.current = null;
177
}, [providers, openProviderSettings]);
178
179
useEffect(() => {
@@ -219,19 +211,15 @@ export function ProviderUpdatePrimaryNotification() {
211
212
const providerCount = oneClickProviders.length;
213
const providerInstanceIds = new Set(oneClickProviders.map((provider) => provider.instanceId));
222
- activeToastRef.current = {
214
+ const activeUpdate: ActiveProviderUpdateToast = {
215
kind: "update",
216
key: notificationKey,
225
- toastId,
217
providerInstanceIds,
218
providerCount,
219
};
220
+ activeToastRef.current = activeUpdate;
221
230
- updateProviderUpdateToast({
231
- toastId,
232
- view: getProviderUpdateRunningToastView(providerCount),
233
- openSettings,
234
- });
222
+ toastManager.close(toastId);
223
224
void (async () => {
225
const results = [];
@@ -248,16 +236,15 @@ export function ProviderUpdatePrimaryNotification() {
236
}
237
238
const activeUpdateToast = activeToastRef.current;
251
- if (activeUpdateToast?.kind !== "update" || activeUpdateToast.toastId !== toastId) {
239
+ if (activeUpdateToast !== activeUpdate) {
240
return;
241
}
242
243
const failedMessage = firstFailedProviderUpdateMessage(results);
244
if (failedMessage) {
257
- updateProviderUpdateToast({
258
- toastId,
245
+ addProviderUpdateToast({
246
view: getProviderUpdateRejectedToastView(providerCount, failedMessage),
260
- openSettings,
247
+ openSettings: openProviderSettings,
248
});
249
activeToastRef.current = null;
250
return;
@@ -271,13 +258,8 @@ export function ProviderUpdatePrimaryNotification() {
258
providers: updatedProviderSnapshots,
259
providerCount,
260
});
274
- updateProviderUpdateToast({
275
- toastId,
276
- view,
277
- openSettings,
278
- });
279
-
280
- if (isTerminalProviderUpdateToastView(view)) {
261
+ if (shouldShowPrimaryProviderUpdateToast(view)) {
262
+ addProviderUpdateToast({ view, openSettings: openProviderSettings });
263
activeToastRef.current = null;
264
}
265
})();