Repository navigation
fix(templates): give the dead controls in the ai-chat template a behavior - #12033
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 66d5962 |
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: one description fix. The demo-toast direction for these controls is settled by the engineering owner's /approve-spec for this head, and the new handlers have no code defects.
- The description says some
ai-chattoasts "said an action had happened when nothing had" and that the change "reworded toast text", but the base template has no toast at all, so please drop that clause and describe the change as added toast handlers.
Non-blocking: each stand-in handler is written twice, once for the desktop toolbar and once for the narrow-screen menu (page.tsx:180-234 and :252-304), so one shared local hook would leave builders a single place to replace; a refused clipboard write shows nothing, where the table template shows "Could not copy …"; and the template keeps existing template-rubric deductions (hand-written CSS and a VStack page root) that this change does not cause.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: several
ai-chatbuttons and menu items did nothing when clicked. Verified: on the base, Send had an empty submit handler, the narrow-screen version items had empty handlers, and Mention, Attach, the toolbar's version items, Copy and Share had none. - Claim: some toasts in the template said an action had happened when nothing had. False: the base template shows no toast.
- Claim: Send, Mention and Attach now show demo toasts. Verified at
page.tsx:399-405,:420-426and:434-440. - Claim: Copy copies the document with
useClipboard, confirms with a "Copied" toast and is announced to screen readers. Verified atpage.tsx:181-187and:253-259; the hook announces on success, and the identical toast announcement is spoken once. - Claim: the version menu and Share show demo toasts in the desktop toolbar and the narrow-screen menu. Verified at
page.tsx:196-234and:269-304. - Claim: each stand-in handler is marked "Demo only" in the source. Verified: nine comments, one per stand-in handler.
- Claim: only handlers and reworded toast text change, with no layout, styling, component, API or doc change. Handlers and no layout, styling, component or API change: verified; reworded toast text: false.
- Claim: sending stays a demo toast and the template has no destructive actions. Verified.
- Claim: clicked in Chromium, Copy fills the clipboard and shows "Copied", Mention and Attach show their toasts, and no page errors occur. Partly reproduced: in a Chromium capture, Share, v1 and Send show their toasts at desktop width and Share shows above the narrow-screen dialog, with no page errors; the headless browser refuses clipboard writes, so the Copy success path was not reproduced, and Mention and Attach were checked in code.
- Claim: a build replay moves no starts, alternatives or block lists. Consistent: the template's doc is unchanged and the page renders no new component; the replay itself was not rerun.
- Claim: type-check, lint and format pass. Verified: the Lint workflow passed on this head.
- Claim (changeset): the dead controls now show demo toasts and Copy copies the document on desktop and narrow screens, with no layout or styling change. Verified.
- Claim (scope): one capability, unrelated fixes split, and no internal context in public text. Verified.
- Claim (scope): consumer docs, focused tests and migration evidence ship with the feature. Not applicable: demo handlers in a template need none, and none ships.
- File
.changeset/ai-chat-working-controls.md: clear. - File
packages/cli/assets/templates/pages/ai-chat/page.tsx: clear apart from the non-blocking notes above.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision, and the description needs one fix.
- The description's "User need" says some
ai-chattoasts "said an action had happened when nothing had", but the base template has no toast at all, so please drop that clause.
No current spec record says what a page template's stand-in controls do, and the earlier /approve-spec named the previous head, so it does not cover this one: an engineering owner records the decision by commenting /approve-spec with this head's full SHA, and the author may do so as an engineering owner. The shared copy hook and the refused-copy toast resolve the earlier notes on Copy. Non-blocking: the v2, v1 and Share toasts are still written twice (page.tsx:206-244 and :273-307), and the template keeps its existing rubric deductions (hand-written CSS and a VStack page root), which this change does not cause.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0)
- Claim: several
ai-chatbuttons and menu items did nothing when clicked. Verified: on the base, Send had an empty submit handler, the narrow-screen version items had empty handlers, and Mention, Attach, the toolbar's version items, Copy and Share had none. - Claim: some toasts in the template said an action had happened when nothing had. False: the base template shows no toast.
- Claim: Send, Mention and Attach show demo toasts. Verified at
page.tsx:403-409,:424-430and:438-444. - Claim: Copy copies the document with
useClipboardthrough one shared local hook and confirms with "Copied" and a screen-reader announcement, or "Could not copy the document" when the browser refuses. Verified atpage.tsx:181-191; the refused path shows its toast in Chromium on desktop and narrow screens; the success path was checked in code, because the headless browser refuses clipboard writes. - Claim: the version menu and Share show demo toasts in the desktop toolbar and the narrow-screen menu. Verified at
page.tsx:206-225,:241-244,:273-290and:302-307. - Claim: each stand-in handler uses the demo-toast wording and is marked "Demo only". Verified: nine comments; the v2 item says "version 2 is already shown" rather than "would … here".
- Claim: the template had no toasts before, so the change adds the toast setup. Verified: Core's toast hook mounts its own viewport, so no provider is needed.
- Claim: the demo-toast pattern is the current specification. Not a current spec record: the pattern exists only in template code, so approval waits on an engineering owner.
- Claim: template source only, with no layout, styling, component, API or doc change. Verified.
- Claim: sending stays a demo toast and the template has no destructive actions. Verified.
- Claim: clicked in Chromium, Copy fills the clipboard and shows "Copied", Mention and Attach show their toasts, and no page errors occur. Partly reproduced: Mention, Share and the refused-copy toast show with no page errors; Attach was checked in code; the clipboard success path is not reproducible headless.
- Claim: a build replay moves no starts, alternatives or block lists. Consistent: the template's doc is unchanged; the replay was not rerun.
- Claim: type-check, lint and format pass. Verified: the page type-checks with the repository settings, and the Lint workflow passed on this head.
- Claim (changeset): the dead controls show demo toasts and Copy copies the document on desktop and narrow screens, with no layout or styling change. Verified.
- Claim (scope): one capability, unrelated fixes split, and no internal context in public text. Verified.
- Claim (scope): consumer docs, focused tests and migration evidence ship with the feature. Not applicable: demo handlers in a template need none, and none ships.
- File
.changeset/ai-chat-working-controls.md: clear. - File
packages/cli/assets/templates/pages/ai-chat/page.tsx: clear apart from the non-blocking notes above.
| {label: 'v2 (current)', onClick: () => {}}, | ||
| {label: 'v1', onClick: () => {}}, | ||
| { | ||
| label: 'v2 (current)', |
There was a problem hiding this comment.
Non-blocking: these v2, v1 and Share toasts repeat the ones in ArtifactActions (lines 206-225 and 241-244). One local hook, as useCopyDocument does for Copy, would leave a builder one place to replace.
|
/approve-spec 70c54a2 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet. The engineering owner's /approve-spec for this head settles the demo-toast and Copy behavior, and the description no longer claims a misleading-toast problem the template never had.
Non-blocking:
- The v2, v1 and Share toasts are still written twice (
page.tsx:206-244and:273-307); one local hook, asuseCopyDocumentdoes for Copy, would leave a builder one place to replace them. - The template keeps its existing rubric deductions (hand-written CSS and a
VStackpage root); this change does not add to them.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0)
- Claim: several
ai-chatbuttons and menu items did nothing when clicked. Verified: on the base, Send had an empty submit handler, the narrow-screen version items had empty handlers, and Mention, Attach, the toolbar's version items, Copy and Share had none. - Claim: Send, Mention and Attach now show demo toasts. Verified at
page.tsx:403-409,:424-430and:438-444, and in Chromium. - Claim: Copy copies the document with
useClipboardthrough one shared local hook and confirms with a "Copied" toast and a screen-reader announcement, or "Could not copy the document" when the browser refuses. Verified atpage.tsx:181-191: in Chromium both toasts show in the desktop toolbar and "Copied" shows from the narrow-screen menu; the announcement comes from the hook'sannounceoption. - Claim: the version menu and Share show demo toasts in the desktop toolbar and the narrow-screen menu. Verified at
page.tsx:206-225,:241-244,:273-290and:302-307; v1 and Share checked in Chromium. - Claim: each stand-in handler uses the "Demo: … would … here" wording and is marked "Demo only". Verified: nine such comments; the v2 item says "version 2 is already shown" rather than "would … here".
- Claim: the template had no toasts before, so the change adds the toast setup. Verified: the base shows no toast, and Core's toast hook mounts its own viewport, so no provider is needed.
- Claim: the template demo-toast pattern is the current specification. Not a current spec record: the engineering owner's approval for this head decides the direction instead.
- Claim: template source only, with no layout, styling, component, API or doc change. Verified.
- Claim: sending stays a demo toast, and the template has no destructive actions. Verified.
- Claim: clicked in Chromium, Copy fills the clipboard and shows "Copied", Mention and Attach show their toasts, and no page errors occur. Reproduced: with the clipboard write stubbed to succeed, Copy writes the document text and shows "Copied"; Mention and Attach show their toasts; no console or page errors.
- Claim: a build replay moves no starts, alternatives or block lists. Consistent: the template's doc is unchanged and its listed components come from JSX tags, which the change does not add; the replay was not rerun.
- Claim: type-check, lint and format pass on the changed files. Verified: the page type-checks with the CLI's strict settings, eslint reports no errors, and prettier is clean.
- Claim (changeset): the dead controls show demo toasts and Copy copies the document on desktop and narrow screens, with no layout or styling change. Verified.
- Claim (scope): one capability, unrelated fixes split, and no internal context in public text. Verified.
- Claim (scope): consumer docs, focused tests and migration evidence ship with the feature. Not applicable: demo handlers in a template need none, and none ships.
- File
.changeset/ai-chat-working-controls.md: clear. - File
packages/cli/assets/templates/pages/ai-chat/page.tsx: clear apart from the non-blocking notes above.
User need
Builders copy page templates and keep their controls. In the
ai-chattemplate, several buttons and menu items did nothing when clicked. A copied page then teaches a control that looks finished but isn't wired.Problem and solution fit
The controls listed below did nothing when clicked. Each now either works or says what the real app would do:
useClipboardthrough one shared local hook, and confirms with a "Copied" toast and a screen-reader announcement, or "Could not copy the document" if the browser refuses. The version menu (v2, v1) and Share show demo toasts. Both apply to the desktop toolbar and the narrow-screen overflow menu.Each new handler shows a toast in the demo-toast pattern ("Demo: … would … here") and is marked "Demo only" in the source. The template had no toasts before, so this adds the toast setup.
Current specification
The template demo-toast pattern: a control that stands in for a real action states the demo action and never implies a backend.
Public delta and caller burden
Template source only: added toast handlers and a real copy through Core's
useClipboard. No layout, styling, component, API or doc change.Design and alternatives
Evidence
Scope
Components: templates (ai-chat)
Testing
tscon the page with the repo tsconfig;eslintandprettieron the changed files