The best way to control Claude Code, Codex and more from any computer or phone
fix(web): bound disconnected send toasts (#9592)
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
maria committed
Sep 4, 2026 at 00:47 UTC
07891e9569c88457516b44c08c820471762969e8
1 file changed
+10
-3
apps/web/src/components/ChatView.tsx
+10
-3
@@ -1335,6 +1335,8 @@ function chatActionErrorMessage(error: unknown): string {
1335
return error instanceof Error ? error.message : "An error occurred.";
1336
}
1337
1338
+const ENVIRONMENT_UNAVAILABLE_SEND_TOAST_TRAIL_SIZE = 3;
1339
+
1340
/**
1341
* Drops the send-time anchored end space. That space is what holds a sent
1342
* message near the top while its turn streams, and it keeps LegendList's
@@ -1641,6 +1643,7 @@ function ChatViewContent(props: ChatViewProps) {
1643
const attachmentPreviewHandoffByMessageIdRef = useRef<Record<string, string[]>>({});
1644
const attachmentPreviewPromotionInFlightByMessageIdRef = useRef<Record<string, true>>({});
1645
const sendInFlightRef = useRef(false);
1646
+ const environmentUnavailableSendToastSlotRef = useRef(0);
1647
const feedbackUploadsInFlightRef = useRef(new Set<string>());
1648
const terminalUiOpenByThreadRef = useRef<Record<string, boolean>>({});
1649
@@ -6073,13 +6076,17 @@ function ChatViewContent(props: ChatViewProps) {
6076
return;
6077
}
6078
if (activeEnvironmentUnavailable) {
6076
- toastManager.add(
6077
- stackedThreadToast({
6079
+ const toastSlot = environmentUnavailableSendToastSlotRef.current;
6080
+ environmentUnavailableSendToastSlotRef.current =
6081
+ (toastSlot + 1) % ENVIRONMENT_UNAVAILABLE_SEND_TOAST_TRAIL_SIZE;
6082
+ toastManager.add({
6083
+ ...stackedThreadToast({
6084
type: "warning",
6085
title: "Not connected: message not sent",
6086
description: "Reconnecting to the environment. Try again once it is connected.",
6087
}),
6082
- );
6088
+ id: `chat-send-environment-unavailable:${toastSlot}`,
6089
+ });
6090
return;
6091
}
6092
if (activePendingProgress) {