Repository navigation
fix(templates): demo actions show a toast instead of alert(), so they respond in frames that block dialogs - #12304
Conversation
… respond in frames that block dialogs
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision: no current spec says what a template's demo action should show, and this pull request switches six of them from alert() to the demo toast and adds a guard against native dialogs in every page and block template. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or by pointing to the spec that governs template demo actions.
- The description says every other template already uses the demo-toast pattern, but seven ChatComposer blocks still log sends with
console.log(for exampleChatComposerSimple.tsxline 13) and 50 no-oponClickhandlers remain, so please reword it to something like "most template demo actions already use the same pattern".
The fix itself checks out: the new test fails on the base with exactly the six alert() calls and passes here, and in Chromium each control now shows its toast with no dialog. CI's Node test legs stop on a leg-budget check that main already fails, not on this change.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the release note says the three templates show a demo toast instead of
alert()— verified (diff, Chromium clicks,astryx templateoutput). - Claim: the six controls call
alert(), which a sandboxed frame without modal permission ignores while a normal tab shows a dialog — verified (the new test on the base; a sandboxed-frame probe; dialogs recorded on the base). - Claim: browsers drop native dialogs in such frames — verified for
alert()in Chromium. - Claim: these calls were the controls' only feedback — verified.
- Claim: every other template already uses the demo-toast pattern — false (ChatComposer blocks log sends to the console; 50 no-op click handlers).
- Claim: Shell Nav, Table Filter's detail panel, the Card blocks and a ChatComposer block use the demo toast — verified.
- Claim: the restoration steps (message builder in Table Filter, toasts in both blocks, new contract test) — verified.
- Claim: the test lists the six calls before the change and passes after it; the toasts show in a real browser with no dialog — verified.
- Claim: Table Filter's detail-panel toasts are unchanged and the other 64 template test files pass — verified.
- Claim: no new public API, default or interaction model, and no internal context — verified.
- Claim: formatting, lint and the CLI typecheck pass — formatting and lint verified; the typecheck's only errors are in two untouched pages.
- File:
.changeset/templates-demo-toasts-not-alerts.md— clear - File:
packages/cli/api/template/no-native-dialogs.test.mjs— clear - File:
packages/cli/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx— clear - File:
packages/cli/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx— clear - File:
packages/cli/assets/templates/pages/table-filter/page.tsx— non-blocking note on the page's size
3204285 to
788e2e6
Compare
|
Owner decision (engineering owner, covering this pull request): template demo actions show the demo toast and never a native dialog ( |
|
/approve-spec 788e2e6 |
There was a problem hiding this comment.
Changes requested: one fix to the new spec text, then this is ready for approval.
- The new FR14 in
spec:AST-028requires every page or block demo action to show a toast that starts withDemo:, but its gap line names only block actions that log or do nothing, while the Table template's Resend invite and Export demo toasts (packages/cli/assets/templates/pages/table/page.tsxlines 461 and 550) showInvite resent to …andExported …; prefix those toasts the FR14 way or add them to the gap line.
The engineering owner's approval at this head settles the direction, the earlier description claim is fixed, and the new guard fails on the base with exactly the six alert() calls and passes here. Two optional notes: the LinkProvider toast could say what the router would do (for example Demo: your router would navigate to /dashboard here), and the Table Filter page remains far past the page-template size guide.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: the release note says the three templates show a demo toast instead of
alert()— verified (diff,astryx templateoutput). - Claim: the six controls call
alert(), which a sandboxed frame without modal permission ignores while a normal tab shows a dialog — verified (scan of the base, sandboxed-frame probe in Chromium). - Claim: browsers drop native dialogs in such frames — verified for
alert()in Chromium. - Claim: these calls were the controls' only feedback — verified.
- Claim: most template demo actions already use the demo-toast pattern — verified.
- Claim: Shell Nav, Table Filter's detail panel, the Card blocks and a ChatComposer block use the demo toast — verified.
- Claim: the restoration steps (message builder in Table Filter, toasts in both blocks, new contract test) — verified.
- Claim: the record now owns demonstration actions, states the demo-toast rule and the dialog ban, and lists the test in its verification map — verified.
- Claim: the gap line records the block demo actions that still log or do nothing — verified as written, but it misses the Table page's two demo toasts without the
Demo:prefix. - Claim: the test lists the six calls before the change and passes after it, beside the other 64 template test files — verified.
- Claim: no new public API, default or interaction model, and no internal context — verified.
- Claim: formatting and lint pass — verified; the CLI typecheck was not rerun, as the code files are unchanged since the previous review.
- Claim: the writing rubric results — verified against the record.
- File:
.changeset/templates-demo-toasts-not-alerts.md— clear - File:
docs/specs/AST-028/spec.md— gap line incomplete (blocking) - File:
packages/cli/api/template/no-native-dialogs.test.mjs— clear - File:
packages/cli/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx— clear - File:
packages/cli/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx— optional wording note - File:
packages/cli/assets/templates/pages/table-filter/page.tsx— optional size note
|
/approve-spec 2880fb9 |
There was a problem hiding this comment.
Approved: the requested change is in, and CI passed on this head.
The Table template's Resend invite and Export toasts now start with Demo: and say what would happen, which was the one change requested last time, and the router-link toast now says what the router would do. The approved demo-toast rule covers every changed control, and the new guard fails on the base with exactly the six alert() calls and passes here. One optional note: the Table Filter page is still far past the page-template size guide, which a later simplification could address.
Claims and files checked
Review mode: incremental; reason: none
- Claim: the release note says the Table Filter template and the Avatar and LinkProvider blocks show a demo toast instead of
alert()— verified (diff, rendered toasts). - Claim: the six controls called
alert(), which a sandboxed frame without modal permission ignores while a normal tab shows a dialog — verified (scan of the base, Chromium dialog sensor and sandboxed-frame probe). - Claim: browsers drop native dialogs in such frames unless modals are allowed — verified for
alert()in Chromium. - Claim: these calls were the controls' only feedback — verified.
- Claim: most template demo actions already use the demo-toast pattern — verified.
- Claim: Shell Nav, Table Filter's detail panel, the Card blocks and a ChatComposer block use the demo toast — verified.
- Claim: the restoration steps (message builder in Table Filter, toasts in both blocks, new contract test) — verified.
- Claim: the record now owns demonstration actions, states the demo-toast rule and the dialog ban, lists the test, and records the block demo actions that still log or do nothing — verified; with the Table page toasts reworded, no page demo toast is left outside the rule.
- Claim: the test lists the six calls on the old sources and passes on the new ones, beside the other template tests — verified (65 test files pass).
- Claim: no new public API, default or interaction model, and no internal context — verified.
- Claim: formatting, lint and the CLI typecheck pass — verified (local formatting and lint, and CI's lint and typecheck jobs).
- Claim: the writing rubric results — verified against the record.
- File:
.changeset/templates-demo-toasts-not-alerts.md— clear - File:
docs/specs/AST-028/spec.md— clear - File:
packages/cli/api/template/no-native-dialogs.test.mjs— clear - File:
packages/cli/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx— clear - File:
packages/cli/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx— clear - File:
packages/cli/assets/templates/pages/table-filter/page.tsx— optional size note - File:
packages/cli/assets/templates/pages/table/page.tsx— clear
User impact
The Table Filter template (New job, and the Assign / Reschedule / Cancel bulk actions) and two example blocks (Avatar with
onClick, LinkProvider custom link) callalert()for their demo actions. A page shown inside a sandboxed frame without modal permission silently ignoresalert(), so in that setting the click does nothing at all, while the same page in a normal tab shows a dialog.Problem and solution fit
alert()/confirm()/prompt()in a sandboxed frame unless it allows modals.useToast()with aDemo: … would happen heremessage and a "Demo only" comment. It works in any frame and does not block the page.Expected behavior and authority
The common template convention: most demo actions show a "Demo: …" toast (for example Shell Nav, Table Filter's own detail-panel buttons, Card and ChatComposer blocks).
Smallest restoration
alertcallback; the bar and New job callshowToast.useToast()replacesalert().alert(),confirm()orprompt().spec:AST-028FR14 states the rule: a template demo action shows aDemo:toast and never a native dialog. Its scope now names demonstration actions, the verification map lists the new test, and an FR14 gap line records the block demo actions that still log to the console or do nothing.Evidence
alert()calls (4 in Table Filter, 1 in each block).packages/cli/api/template/no-native-dialogs.test.mjsfails on the old sources and passes on the new ones.Scope
Components: Table Filter template, Avatar and LinkProvider blocks,
spec:AST-028Testing
pnpm vitest run packages/cli/api/template(64 files passed) plus the new testpnpm -F @astryxdesign/cli typecheckWriting rubric results
R1 narration: none; FR14, the scope sentence and the gap line are present-tense statements about templates.
R2 research: none in the record.
R3 evidence: the FR14 verification row names the template contract test and its cases, no pull request.
R4 rejected alternatives: none recorded.
R5 change references: none added.
R6 open questions: none added.
R7 project status: the remaining console-log and no-op demo handlers are stated as "FR14 gap: …", not as a plan.