Skip to content

fix(templates): give the dead controls in the ai-chat template a behavior - #12033

Merged
josephfarina merged 5 commits into
mainfrom
josephfarina/ai-chat-working-controls
Nov 16, 2026
Merged

josephfarina merged 5 commits into
mainfrom
josephfarina/ai-chat-working-controls

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

User need

Builders copy page templates and keep their controls. In the ai-chat template, 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:

  • The composer: Send (submitting the message), Mention and Attach.
  • The document panel: Copy now copies the document to the clipboard with Core's useClipboard through 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

  • Toasts, not new features. Sending a message stays a demo toast: the thread is static sample content, not local state, and a real send needs a model behind it.
  • No destructive actions in this template.

Evidence

  • Clicked in Chromium: Copy puts the document text on the clipboard and shows "Copied"; Mention and Attach show their "Demo: …" toasts; no page errors.
  • A build replay over the full set of build ideas moves zero starts, zero alternatives and zero block lists.

Scope

Components: templates (ai-chat)

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • tsc on the page with the repo tsconfig; eslint and prettier on the changed files
  • Sandbox click-through in Chromium of the changed controls

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 16, 2026 9:50am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@astracat-bot

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 16, 2026, 10:05 AM UTC

@josephfarina josephfarina changed the title fix(templates): make every ai-chat template control work or say what it would do fix(templates): give the dead controls in the ai-chat template a behavior Nov 16, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 66d5962

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 2f3988a

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot 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.

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-chat toasts "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-chat buttons 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-426 and :434-440.
  • Claim: Copy copies the document with useClipboard, confirms with a "Copied" toast and is announced to screen readers. Verified at page.tsx:181-187 and :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-234 and :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.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot 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 waits on an engineering owner's decision, and the description needs one fix.

  • The description's "User need" says some ai-chat toasts "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-chat buttons 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-430 and :438-444.
  • Claim: Copy copies the document with useClipboard through one shared local hook and confirms with "Copied" and a screen-reader announcement, or "Could not copy the document" when the browser refuses. Verified at page.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-290 and :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.

Automated review (maintainer link)

{label: 'v2 (current)', onClick: () => {}},
{label: 'v1', onClick: () => {}},
{
label: 'v2 (current)',

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.

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.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 70c54a2

@astracat-bot astracat-bot Bot 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.

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-244 and :273-307); one local hook, as useCopyDocument does for Copy, would leave a builder one place to replace them.
  • The template keeps its existing rubric deductions (hand-written CSS and a VStack page root); this change does not add to them.
Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0)
  • Claim: several ai-chat buttons 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-430 and :438-444, and in Chromium.
  • Claim: Copy copies the document with useClipboard through 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 at page.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's announce option.
  • 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-290 and :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.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 9407524 into main Nov 16, 2026
77 checks passed
@github-actions
github-actions Bot deleted the josephfarina/ai-chat-working-controls branch November 17, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 70c54a2b Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant