Skip to content

Port feature from vitejs/devtools#526: render message actions as buttons on toast notifications #212

Description

@antfubot

Context

vitejs/devtools#526 ("feat(core): render message actions as buttons on toast notifications") by @dvcolomban rendered a message entry's actions (e.g. activate, which focuses a dock) as buttons on the toast itself, not just in the messages panel's detail view — and fixed a dock-id typo (devframes-plugin-messages with hyphens vs. the real mounted id devframes_plugin_messages with underscores, a leftover from the devframe 0.6 migration, vitejs/devtools#396) that silently broke "click a toast to open messages." It touched packages/core/src/client/webcomponents/components/display/ToastOverlay.vue in vitejs/devtools, which moved here as part of the v0.9 migration — the equivalent file today is packages/hub-ui/src/client/components/display/ToastOverlay.vue.

The PR also added a "Toast: With Action" demo button to playgrounds/core/src/pages/devtools.vue — that playground file still exists in vitejs/devtools unaffected, so that part of the PR can be re-added there directly rather than ported here.

Original PR description

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 (#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.

Diff: https://github.com/vitejs/devtools/pull/526/files

For agents picking this up

  • Read the diff at feat(core): render message actions as buttons on toast notifications vitejs/devtools#526 for the toast #actions slot rendering and the switchEntry dispatch pattern.
  • Port the ToastOverlay.vue change to packages/hub-ui/src/client/components/display/ToastOverlay.vue (+ its .stories.ts), adapting to whatever has shifted since the fork.
  • Verify the devframes_plugin_messages (underscore) id typo fix is/isn't already correct in this repo's current @devframes/plugin-messages constants.ts and any switchEntry(...) call sites — the bug may be specific to how vitejs/devtools referenced the id, or it may still exist here too.
  • The playground demo button doesn't need porting here — it can be re-added directly to vitejs/devtools's playgrounds/core/src/pages/devtools.vue, which is unaffected by the migration.
  • Credit @dvcolomban as the original author: include a Co-authored-by: dvcolomban <...> trailer (look up their GitHub noreply email, or omit if unavailable) and mention them in the PR description.
  • Link back to feat(core): render message actions as buttons on toast notifications vitejs/devtools#526 in the PR description.
  • Close this issue when the port merges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions