fix(web): dismiss stale connection error toast after ws reconnect - #1474
Merged
Conversation
🦋 Changeset detectedLatest commit: f93ddfe The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No linked issue. Reported via in-product feedback.
Problem
On iOS Safari, after the tab is backgrounded for ~30s and brought back to the foreground, the WebSocket reconnects successfully and messages flow again, but the "Realtime connection error" toast stays on screen until the page is manually refreshed.
iOS Safari freezes the page's timers while a tab is in the background. The connection error toast is dismissed only by an auto-dismiss timer, so a timer that started before or during backgrounding is still frozen when the user returns. The foreground recovery path restores the WebSocket data channel but never clears the warning, so the stale toast lingers even though the connection is already healthy.
What changed
When the connection state machine transitions to connected (after the server handshake completes), the web client now drops any pending realtime-connection-error warning from the warning list instead of relying on its auto-dismiss timer. The existing toast reconcile then removes the toast and clears its (possibly frozen) timer. This keeps the current recovery behavior and ties UI cleanup to the same reconnection signal.
No new test:
useKimiWebClientis a module-level singleton with no existing test harness, and adding one is disproportionate for this targeted fix. Typecheck and the existing kimi-web test suite (358 tests) pass.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.