Skip to content

fix(hub-ui): dismiss toasts when messages are removed - #375

Merged
antfu merged 1 commit into
devframes:mainfrom
dvcolomban:dvcol/fix-message-toast-removal
Sep 9, 2026
Merged

fix(hub-ui): dismiss toasts when messages are removed#375
antfu merged 1 commit into
devframes:mainfrom
dvcolomban:dvcol/fix-message-toast-removal

Conversation

@dvcolomban

Copy link
Copy Markdown
Contributor

Background (Why)

Dismissing a message through its host handle removes it from the message center, but its toast remains visible. Full-state reconciliation also leaves toasts for removed messages behind.

Changes (What)

Dismiss the corresponding toast when applying message removals, including entries absent from a full snapshot. Retain existing entries during reconciliation so surviving messages do not increment unread counts or create another toast.

Verification (Testing)

Reproduced in the latest hub-ui browser playground using a persistent host message and a command that calls its dismiss() handle. The toast remained before the fix and disappeared after it. Added regressions for incremental removal, full-state removal, timer cleanup and surviving messages. The six message/toast tests, affected lint and hub-ui type check pass.

Copilot AI lite review requested due to automatic review settings September 9, 2026 09:47
@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 9, 2026

Copy link
Copy Markdown

◈ PR Lens

🟢 +0 new · 🟠 ~1 changed · 🔴 -0 removed · 1 flow · 2 files · commit 6df25f3


Architecture

Architecture diagram for devframes/devframe at 6df25f3

1 component touched across 2 lanes.

Open the interactive canvas


Data flow

Data flow diagram for devframes/devframe at 6df25f3

Syncing message updates and dismissals

Open the interactive canvas


Drill down
Client Runtimes & UI — 1 component
🟡 CHANGED Dock UI & Web Component

Manages message entries, unread counts, and active toast notifications.


View

  • Architecture lens
  • Data flow lens
  • Expand every detail
  • Show unchanged neighbours

Tip

Show unchanged neighbours lists the components this change did not touch alongside the ones it did, so the drill-down shows what the changed code sits next to.

🪧 More tips
  • Run PR Lens on your own machine: npx skills add coldteadotai/pr-lens installs the agent skill. Then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Draw a diff before it is even a pull request: npx @coldtea/pr-lens-cli analyze --base origin/main reads the diff with your own model key, and npx @coldtea/pr-lens-cli render .pr-lens/graph.json draws the same lenses on your machine.
  • The boxes under View are live. Tick Architecture lens or Data flow lens to choose which diagrams appear, or Expand every detail to open every drill-down at once. The comment redraws in place a few seconds later.
  • GitHub will not let you zoom an image in a comment. The link under each diagram opens it on an interactive canvas, where you can zoom, pan and step through the flow.
  • The CLI's render picks up .github/pr-lens.yml automatically and applies your corrections (renames, exclusions, lane pins) at draw time.
  • Would you rather run it from CI on a key of your own? Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and a model key in your repository secrets, say GEMINI_API_KEY. The Action asks Gemini by default, or OpenAI and any endpoint speaking /chat/completions through its provider input.
  • PR Lens is free for open source. A star on the repository is what keeps it going.
  • Push a new commit and the whole comment re-renders for the new head. An older run never overwrites a newer one, so a slow render cannot put a stale diagram back.
  • The diagrams follow your GitHub theme, so dark mode gets the dark render and light mode the light one, and the moving dots show this pull request's data in motion.

◈ Rendered by PR Lens · crafted with ❤️ by the Coldtea team · Come say hi on Discord

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
devframe Skipped Skipped Sep 9, 2026 10:16am UTC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change correctly dismisses toasts for removed messages and adds focused regression tests; the only feedback is a minor performance optimization suggestion.

Pull request overview

This PR fixes hub-ui message/toast reconciliation so that when messages are removed (via incremental deltas or full snapshots), any corresponding visible toast is also dismissed, preventing stale toasts from lingering after the message is gone.

Changes:

  • Dismiss the toast when a message id is removed from the messages state (including removals inferred during full snapshots).
  • Preserve surviving entries during full-snapshot reconciliation to avoid re-notifying and re-incrementing unread counts.
  • Add regression tests covering incremental removal, full-snapshot removal, timer cleanup, and full-snapshot retention behavior.
File summaries
File Description
packages/hub-ui/src/client/state/messages.ts Updates reconciliation logic to infer removals on full snapshots and dismiss associated toasts while retaining surviving entries.
packages/hub-ui/src/client/state/messages.test.ts Adds state-level tests to ensure toasts/timers are cleaned up on removal and that full snapshots don’t re-toast or bump unread counts for surviving messages.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/hub-ui/src/client/state/messages.ts
Copilot AI review requested due to automatic review settings September 9, 2026 10:16
@dvcolomban
dvcolomban force-pushed the dvcol/fix-message-toast-removal branch from 7ebfd82 to 6df25f3 Compare September 9, 2026 10:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reconciliation change is narrowly scoped, aligns with the stated bug, and is covered by targeted regressions for both delta and full-snapshot scenarios.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@antfu
antfu merged commit 1b71074 into devframes:main Sep 9, 2026
14 checks passed
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.

3 participants