Skip to content

Commit 9b00d4c

Browse files
fix(web): every reconnect gets its own grace period before the unavailable banner
Since #20418 moved the reset out of an effect, the elapsed grace stayed recorded for an environment after it reconnected, so its next reconnect showed the unavailable banner at once. The grace now resets during render whenever the reconnecting environment changes, including back to none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f5cb328 commit 9b00d4c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,15 @@ export default function ChatView(props: ChatViewProps) {
19431943
: null;
19441944
const [reconnectWarningGraceElapsedEnvironmentId, setReconnectWarningGraceElapsedEnvironmentId] =
19451945
useState<EnvironmentId | null>(null);
1946+
// Each reconnect attempt gets its own grace period, including a later one to
1947+
// the same environment.
1948+
const [graceReconnectingEnvironmentId, setGraceReconnectingEnvironmentId] = useState(
1949+
activeReconnectingEnvironmentId,
1950+
);
1951+
if (graceReconnectingEnvironmentId !== activeReconnectingEnvironmentId) {
1952+
setGraceReconnectingEnvironmentId(activeReconnectingEnvironmentId);
1953+
setReconnectWarningGraceElapsedEnvironmentId(null);
1954+
}
19461955
const reconnectWarningGraceElapsed = hasEnvironmentReconnectWarningGraceElapsed(
19471956
activeReconnectingEnvironmentId,
19481957
reconnectWarningGraceElapsedEnvironmentId,

0 commit comments

Comments
 (0)