fix(web): bound disconnected send toasts (#9592)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
b34ff8f564
commit
07891e9569
1 file changed
+10
-3
@@ -1335,6 +1335,8 @@ function chatActionErrorMessage(error: unknown): string {
|
||||
return error instanceof Error ? error.message : "An error occurred.";
|
||||
}
|
||||
|
||||
const ENVIRONMENT_UNAVAILABLE_SEND_TOAST_TRAIL_SIZE = 3;
|
||||
|
||||
/**
|
||||
* Drops the send-time anchored end space. That space is what holds a sent
|
||||
* message near the top while its turn streams, and it keeps LegendList's
|
||||
@@ -1641,6 +1643,7 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
const attachmentPreviewHandoffByMessageIdRef = useRef<Record<string, string[]>>({});
|
||||
const attachmentPreviewPromotionInFlightByMessageIdRef = useRef<Record<string, true>>({});
|
||||
const sendInFlightRef = useRef(false);
|
||||
const environmentUnavailableSendToastSlotRef = useRef(0);
|
||||
const feedbackUploadsInFlightRef = useRef(new Set<string>());
|
||||
const terminalUiOpenByThreadRef = useRef<Record<string, boolean>>({});
|
||||
|
||||
@@ -6073,13 +6076,17 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
return;
|
||||
}
|
||||
if (activeEnvironmentUnavailable) {
|
||||
toastManager.add(
|
||||
stackedThreadToast({
|
||||
const toastSlot = environmentUnavailableSendToastSlotRef.current;
|
||||
environmentUnavailableSendToastSlotRef.current =
|
||||
(toastSlot + 1) % ENVIRONMENT_UNAVAILABLE_SEND_TOAST_TRAIL_SIZE;
|
||||
toastManager.add({
|
||||
...stackedThreadToast({
|
||||
type: "warning",
|
||||
title: "Not connected: message not sent",
|
||||
description: "Reconnecting to the environment. Try again once it is connected.",
|
||||
}),
|
||||
);
|
||||
id: `chat-send-environment-unavailable:${toastSlot}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (activePendingProgress) {
|
||||
|
||||
Reference in new issue
Block a user