From 003d03ff9e4a109080076031454f31461aebc1b0 Mon Sep 17 00:00:00 2001 From: Josh Gratton Date: Sat, 13 Jun 2026 20:03:47 -0400 Subject: [PATCH] fix(web): close the per-environment update toast when its updates clear MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous review fix gated closing a stale, un-acted prompt on canShowPrompt, which is false once notificationKey becomes null (all updates cleared) — so the toast could linger empty after the updates disappeared. Close it when the update set clears (key null) or a fresh set can replace it, and keep it only while a backend is re-settling (updates still exist, just gated) or an update is already in progress. --- .../ProviderUpdateLaunchNotification.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/ProviderUpdateLaunchNotification.tsx b/apps/web/src/components/ProviderUpdateLaunchNotification.tsx index fbe9b77d8b..85c8128607 100644 --- a/apps/web/src/components/ProviderUpdateLaunchNotification.tsx +++ b/apps/web/src/components/ProviderUpdateLaunchNotification.tsx @@ -111,12 +111,18 @@ function ProviderUpdateEnvironmentsNotification() { !dismissedNotificationKeys.has(notificationKey) && !seenProviderUpdateNotificationKeys.has(notificationKey); - // Replace a prompt the user hasn't acted on yet when the available updates - // change — but only when a replacement can take its place, so the popover - // never just disappears (e.g. while backends are re-settling). Once an - // update is in progress, keep the toast so its rows survive. + // Close a prompt the user hasn't acted on yet when the available updates + // change: when they clear entirely (key null) so the toast doesn't linger, + // and when a fresh set is ready to replace it. Keep it only while a backend + // is re-settling (updates still exist, just gated) — and once an update is + // in progress, so its rows survive. const active = activeToastRef.current; - if (active && active.key !== notificationKey && !hasInteractedRef.current && canShowPrompt) { + if ( + active && + active.key !== notificationKey && + !hasInteractedRef.current && + (notificationKey === null || !isGated) + ) { toastManager.close(active.toastId); activeToastRef.current = null; }