Skip to content

feat(core): render message actions as buttons on toast notifications - #526

Open
dvcolomban wants to merge 4 commits into
vitejs:mainfrom
dvcolomban:dvcol/toast-message-actions
Open

feat(core): render message actions as buttons on toast notifications#526
dvcolomban wants to merge 4 commits into
vitejs:mainfrom
dvcolomban:dvcol/toast-message-actions

Conversation

@dvcolomban

@dvcolomban dvcolomban commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Why

Toasts only ever showed the dismiss ✕ — an entry's own actions (e.g. the activate kind, which focuses a dock) only rendered in the messages panel's detail view, not on the toast that actually announced it.

What changed

  • Renders entry.actions as buttons in the toast's own #actions slot, dispatching the same way the messages panel does: switchEntry(action.activate.dockId).
  • Fixes a pre-existing bug found while manually testing this: switchEntry('devframes-plugin-messages') (hyphens) never matched the dock's real mounted id, devframes_plugin_messages (underscores, PLUGIN_ID in @devframes/plugin-messages's constants.ts) — a typo from the devframe 0.6 migration (feat!: migrate to devframe 0.6 — official plugins, crossws + OTP auth #396) that's been silently breaking "click a toast to open messages" ever since.
  • Adds a "Toast: With Action" button next to the existing Quick Actions in the playground's debug dashboard, so this (and the id fix) is easy to re-verify by hand later.

Linked Issues

Additional context

Verified by hand against the playground: firing the new demo toast and clicking its action button focuses the messages dock. Full gate (pnpm build/test/typecheck/lint) green — 381 tests passing.

Toasts only exposed the dismiss ✕ button; an entry's own `actions`
(e.g. an `activate` action that focuses a dock) were only rendered in
the messages panel's detail view. Render them as buttons in the
toast's `#actions` slot too, dispatching the same way the messages
panel does: `switchEntry(action.activate.dockId)`, the local
counterpart of the `hub:docks:activate` RPC our shell already handles
in `context.ts`.
`switchEntry('devframes-plugin-messages')` (hyphens) never matched the
actual mounted dock id, `devframes_plugin_messages` (`PLUGIN_ID` in
`@devframes/plugin-messages`'s `constants.ts`) — a typo introduced by
the devframe 0.6 migration (vitejs#396). Clicking a toast to open the
messages panel silently no-op'd; same typo had just been copied into
the new `WithAction` story added alongside toast action buttons.
Manual coverage for the new toast action buttons (previous commit):
"Toast: With Action" fires a message with a `view` action that focuses
the messages dock, exercising `ToastOverlay`'s new `#actions` rendering
and `dispatchAction` end to end alongside the existing Quick Actions.
@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@526

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@526

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@526

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@526

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@526

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@526

commit: a5494cf

@dvcolomban
dvcolomban marked this pull request as ready for review August 10, 2026 15:17
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