| ... | @@ -1335,6 +1335,8 @@ function chatActionErrorMessage(error: unknown): string { | ... | @@ -1335,6 +1335,8 @@ function chatActionErrorMessage(error: unknown): string { |
| 1335 | return error instanceof Error ? error.message : "An error occurred."; | 1335 | return error instanceof Error ? error.message : "An error occurred."; |
| 1336 | } | 1336 | } |
| 1337 | | 1337 | |
| | 1338 | const ENVIRONMENT_UNAVAILABLE_SEND_TOAST_TRAIL_SIZE = 3; |
| | 1339 | |
| 1338 | /** | 1340 | /** |
| 1339 | * Drops the send-time anchored end space. That space is what holds a sent | 1341 | * Drops the send-time anchored end space. That space is what holds a sent |
| 1340 | * message near the top while its turn streams, and it keeps LegendList's | 1342 | * message near the top while its turn streams, and it keeps LegendList's |
| ... | @@ -1641,6 +1643,7 @@ function ChatViewContent(props: ChatViewProps) { | ... | @@ -1641,6 +1643,7 @@ function ChatViewContent(props: ChatViewProps) { |
| 1641 | const attachmentPreviewHandoffByMessageIdRef = useRef<Record<string, string[]>>({}); | 1643 | const attachmentPreviewHandoffByMessageIdRef = useRef<Record<string, string[]>>({}); |
| 1642 | const attachmentPreviewPromotionInFlightByMessageIdRef = useRef<Record<string, true>>({}); | 1644 | const attachmentPreviewPromotionInFlightByMessageIdRef = useRef<Record<string, true>>({}); |
| 1643 | const sendInFlightRef = useRef(false); | 1645 | const sendInFlightRef = useRef(false); |
| | 1646 | const environmentUnavailableSendToastSlotRef = useRef(0); |
| 1644 | const feedbackUploadsInFlightRef = useRef(new Set<string>()); | 1647 | const feedbackUploadsInFlightRef = useRef(new Set<string>()); |
| 1645 | const terminalUiOpenByThreadRef = useRef<Record<string, boolean>>({}); | 1648 | const terminalUiOpenByThreadRef = useRef<Record<string, boolean>>({}); |
| 1646 | | 1649 | |
| ... | @@ -6073,13 +6076,17 @@ function ChatViewContent(props: ChatViewProps) { | ... | @@ -6073,13 +6076,17 @@ function ChatViewContent(props: ChatViewProps) { |
| 6073 | return; | 6076 | return; |
| 6074 | } | 6077 | } |
| 6075 | if (activeEnvironmentUnavailable) { | 6078 | if (activeEnvironmentUnavailable) { |
| 6076 | toastManager.add( | 6079 | const toastSlot = environmentUnavailableSendToastSlotRef.current; |
| 6077 | stackedThreadToast({ | 6080 | environmentUnavailableSendToastSlotRef.current = |
| | 6081 | (toastSlot + 1) % ENVIRONMENT_UNAVAILABLE_SEND_TOAST_TRAIL_SIZE; |
| | 6082 | toastManager.add({ |
| | 6083 | ...stackedThreadToast({ |
| 6078 | type: "warning", | 6084 | type: "warning", |
| 6079 | title: "Not connected: message not sent", | 6085 | title: "Not connected: message not sent", |
| 6080 | description: "Reconnecting to the environment. Try again once it is connected.", | 6086 | description: "Reconnecting to the environment. Try again once it is connected.", |
| 6081 | }), | 6087 | }), |
| 6082 | ); | 6088 | id: `chat-send-environment-unavailable:${toastSlot}`, |
| | 6089 | }); |
| 6083 | return; | 6090 | return; |
| 6084 | } | 6091 | } |
| 6085 | if (activePendingProgress) { | 6092 | if (activePendingProgress) { |