Skip to content

Commit 087af44

Browse files
fix(examples): showcase 首页 "Create Task" 按钮改用 element:button 的内联 action (#6737)
`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 Claude-Session: https://claude.ai/code/session_01F8q5J1MQyocgtNspb15fSn Co-authored-by: Claude <noreply@anthropic.com>
1 parent 15370cd commit 087af44

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • examples/app-showcase/src/ui/pages

examples/app-showcase/src/ui/pages/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,20 @@ export const ComponentGalleryPage = definePage({
7979
],
8080
},
8181
},
82-
{ type: 'element:button', properties: { label: 'Create Task', actionName: 'showcase_new_task' } },
82+
// The page's primary CTA. `element:button` carries an **inline** action
83+
// (`action`, an InlineActionSchema) — it is NOT a by-name reference to a
84+
// registered object action; that is `action:button`. This block used to
85+
// author `actionName: 'showcase_new_task'`, a key `ElementButtonPropsSchema`
86+
// never declared: the strip-mode parse dropped it, the renderer reads only
87+
// `props.action`, and its `handleClick` opens with `if (!action) return` —
88+
// so the button rendered, was clickable, and the click did nothing at all
89+
// (no request, no dialog, no navigation). #6597.
90+
//
91+
// `type: 'modal'` + a string `target` is resolved page-first, then object
92+
// (objectui `useActionModal.resolveModalTarget`); `showcase_task` names no
93+
// page, so it lands on the object and opens the Task create form — which is
94+
// what a button labelled "Create Task" should do.
95+
{ type: 'element:button', properties: { label: 'Create Task', icon: 'plus', action: { name: 'showcase_new_task', type: 'modal', target: 'showcase_task', refreshAfter: true } } },
8396
],
8497
},
8598
{

0 commit comments

Comments
 (0)