Skip to content

fix(web): dismiss stale connection error toast after ws reconnect - #1474

Merged
wbxl2000 merged 1 commit into
mainfrom
fix/web-ws-reconnect-toast
Jul 7, 2026
Merged

fix(web): dismiss stale connection error toast after ws reconnect#1474
wbxl2000 merged 1 commit into
mainfrom
fix/web-ws-reconnect-toast

Conversation

@wbxl2000

@wbxl2000 wbxl2000 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

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: useKimiWebClient is 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

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f93ddfe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@f93ddfe
npx https://pkg.pr.new/@moonshot-ai/kimi-code@f93ddfe

commit: f93ddfe

@wbxl2000
wbxl2000 merged commit 11c6a37 into main Jul 7, 2026
11 checks passed
@wbxl2000
wbxl2000 deleted the fix/web-ws-reconnect-toast branch July 7, 2026 12:47
@github-actions github-actions Bot mentioned this pull request Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant