From 653367accb52037a73361453ec4d375adab10a76 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 8 Aug 2026 13:24:46 +0000 Subject: [PATCH] =?UTF-8?q?fix(examples):=20showcase=20=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=20"Create=20Task"=20=E6=8C=89=E9=92=AE=E6=94=B9=E7=94=A8=20ele?= =?UTF-8?q?ment:button=20=E7=9A=84=E5=86=85=E8=81=94=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `showcase_component_gallery` 的主 CTA 之前授权的是 `actionName: 'showcase_new_task'` —— `ElementButtonPropsSchema` 从未声明这个键。schema 是 strip 模式,parse 直接把它 剥掉;renderer 只读 `props.action`,`handleClick` 第一行就是 `if (!action) return`。 结果是按钮正常渲染、正常可点,点击完全空转:不发请求、不开弹窗、不导航。 `element:button` 携带的是**内联** action(InlineActionSchema),它本来就不是"按名 引用已注册动作"——那是 `action:button`。所以修的是语料这一处,不是契约。 `type: 'modal'` + 字符串 `target` 由 objectui 的 `useActionModal.resolveModalTarget` 先按 page、再按 object 解析;`showcase_task` 不是任何 page 的名字,于是落到对象上, 打开 Task 的新建表单 —— 这才是一个写着 "Create Task" 的按钮该做的事。 Fixes #6597 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01F8q5J1MQyocgtNspb15fSn --- examples/app-showcase/src/ui/pages/index.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/app-showcase/src/ui/pages/index.ts b/examples/app-showcase/src/ui/pages/index.ts index ac4e9acca3..60442b81ec 100644 --- a/examples/app-showcase/src/ui/pages/index.ts +++ b/examples/app-showcase/src/ui/pages/index.ts @@ -79,7 +79,20 @@ export const ComponentGalleryPage = definePage({ ], }, }, - { type: 'element:button', properties: { label: 'Create Task', actionName: 'showcase_new_task' } }, + // The page's primary CTA. `element:button` carries an **inline** action + // (`action`, an InlineActionSchema) — it is NOT a by-name reference to a + // registered object action; that is `action:button`. This block used to + // author `actionName: 'showcase_new_task'`, a key `ElementButtonPropsSchema` + // never declared: the strip-mode parse dropped it, the renderer reads only + // `props.action`, and its `handleClick` opens with `if (!action) return` — + // so the button rendered, was clickable, and the click did nothing at all + // (no request, no dialog, no navigation). #6597. + // + // `type: 'modal'` + a string `target` is resolved page-first, then object + // (objectui `useActionModal.resolveModalTarget`); `showcase_task` names no + // page, so it lands on the object and opens the Task create form — which is + // what a button labelled "Create Task" should do. + { type: 'element:button', properties: { label: 'Create Task', icon: 'plus', action: { name: 'showcase_new_task', type: 'modal', target: 'showcase_task', refreshAfter: true } } }, ], }, {