Skip to content

fix(examples): edit the dashboard that is open, and keep its panel across an edit - #1599

Merged
ankit-thesys merged 1 commit into
abhin/dashboards-example-fixesfrom
ankit/dashboards-example-edit-fixes
Nov 10, 2026
Merged

ankit-thesys merged 1 commit into
abhin/dashboards-example-fixesfrom
ankit/dashboards-example-edit-fixes

Conversation

@ankit-thesys

Copy link
Copy Markdown
Contributor

Stacked on #1595 (base branch abhin/dashboards-example-fixes). Two fixes to editing in examples/miscellaneous/assistant-ui-dashboards, found while testing that PR on dev.

1. An edit went to the wrong dashboard

Before: a thread has dashboard A, then B. Open A and ask "add a subtitle to this dashboard". B is edited and the panel switches to B. A dashboard opened from the Dashboards list beside a new chat could not be edited at all.

Why: /api/chat received only messages, so the model could not know which dashboard was open, and the prompt said "the dashboard" means the latest one.

Now:

  • components/dashboard.tsx keeps the open panel's artifact id in a ref (openDashboardId).
  • components/app.tsx sends it with each chat request through AssistantChatTransport({ body }).
  • app/api/chat/route.ts validates it (art_…) and names it in the system prompt.
  • lib/prompt.ts: "it", "this" or "the dashboard" means the open one when there is one, otherwise the latest.

2. Every edit reset the panel's filters and scroll position

Before: set a selector to a non-default value, scroll down, send any edit. When the edit lands the selector is back to its default and the scroll is at the top.

Why: the edit's card called setOpen({ key: toolCallId, … }), and the panel is keyed by that key, so it remounted.

Now: an edit to the dashboard already in the panel leaves the panel mounted. It follows the edit through the stream it shares with the card. All of a dashboard's cards read as open ("Close") while the panel shows it.

Verified

On the dev backend, in the browser:

Case Result
A opened from the Dashboards list beside a new, empty chat; "change the subtitle of this dashboard" Edit landed on A
A open; "build a separate new dashboard for zod" A new dashboard was created
Thread has A, then zod; A reopened from its card; "add a note under the title of this dashboard" Edit landed on A; the reply named it as the one open beside the chat
A open, selector set to "vue", panel scrolled 300 px; edit sent New version shown, selector still "vue", scroll still 300 px, the panel's DOM node was kept, no error

tsc --noEmit is clean for the example.

Not tested

  • An edit with no panel open (should fall back to the latest dashboard).
  • An edit that names another dashboard while one is open.
  • A create while another dashboard is open still opens the new one, as before; only an edit to the dashboard already showing skips the reopen.

🤖 Generated with Claude Code

…ross an edit

Two fixes to editing in assistant-ui-dashboards.

An edit went to the latest dashboard in the thread, not the one open beside
the chat: the chat route only received the messages, so the model could not
know which dashboard the user was looking at. Each chat request now carries
the open dashboard's artifact id, the route validates it and names it in the
system prompt, and the prompt reads "it", "this" or "the dashboard" as the
open one when there is one. A dashboard opened from the list beside a new
chat can now be edited too.

Every edit rebuilt the panel, which reset its filters and scroll position:
the edit's card reopened the panel under its own tool call id, and the panel
is keyed by that. An edit to the dashboard already in the panel now leaves it
mounted; it follows the edit through the stream it shares with the card. All
of a dashboard's cards read as open while the panel shows it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
openui-docs Ready Ready Preview Nov 9, 2026 10:45pm UTC

Request Review

@ankit-thesys

Copy link
Copy Markdown
Contributor Author

Before / after recording (4 min 10 s). First half is the base branch (#1595 head f8402ebaf), second half from 1:54 is this PR. Same scripted steps in both, captioned bottom-left.

pr1599-before-after.mp4

Steps: build dashboard A (npm downloads with a Package filter), build B (zod) in the same chat, reopen A, set the filter to vue and scroll, then ask to add a note to "this dashboard", scroll again and send a second edit.

Before After
Edit lands on B (zod), the latest one; panel switches to it A, the one open
Package filter after the edit lost still vue
Scroll after edit 1 / edit 2 0 px / 0 px (was 220 / 260) 220 px / 260 px

@ankit-thesys
ankit-thesys merged commit b8b2512 into abhin/dashboards-example-fixes Nov 10, 2026
2 checks passed
@ankit-thesys
ankit-thesys deleted the ankit/dashboards-example-edit-fixes branch November 10, 2026 15:13

This branch was successfully deployed

1 active deployment
Preview — c64022ea Deployed Nov 9, 2026 by vercel[bot]
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.

2 participants