From de0205717add6ac00132fa9cf3e4ae09357b94cf Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 00:32:58 +0000 Subject: [PATCH] docs(guide): author the page-mode navigate actions where the renderer reads them (objectui#7440) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `record-edit-modes.md` taught three `action:button` examples that put the action name in a nested `action` bag. `action-button.tsx` never reads `schema.action`: it forwards `type: schema.actionType` and `params: schema.params`, and `ActionRunner.execute` dispatches on `action.type || action.actionType || action.name`. The documented shape therefore forwarded `type: undefined` and matched no handler — a button that rendered, clicked, and did nothing. The `navigate_create` / `navigate_edit` handlers are live (`AppContent.tsx:475,487`); only the authoring shape was wrong. Each example is repaired for what it was demonstrating: - example 1 (`navigate_create` with an explicit object): mis-authored, rewritten to `actionType` + top-level `params`. - example 2 (`navigate_edit`): same rewrite, and its `${record.id}` replaced with a literal id. Measured: `params` is not template- evaluated on any authoring channel, and `action:button` does not inject the surrounding row (`DeclaredActionsBar.tsx:110`), so the template arrived at the handler verbatim. - example 3 (context-supplied object): demonstrates omitting the arguments, so the repair keeps `params` absent rather than filling it in. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01KbJQ1y1J12nZxYzFWhP8Q3 --- content/docs/guide/record-edit-modes.md | 39 +++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/content/docs/guide/record-edit-modes.md b/content/docs/guide/record-edit-modes.md index e379d2a830..c35b3f3f59 100644 --- a/content/docs/guide/record-edit-modes.md +++ b/content/docs/guide/record-edit-modes.md @@ -62,45 +62,54 @@ refresh the page mid-edit (the form rehydrates from the URL `:recordId`). ## Triggering the routes from JSON In addition to the implicit "click create/edit on a list" entry point, -two declarative actions let you open the page-mode routes from any -`` in metadata: +two declarative actions let you open the page-mode routes from an +`action:button` in metadata. The handler name goes in `actionType`: that +is the key the button renderer forwards to the action runner as the +action's type, and the runner dispatches to the handler registered under +it. Arguments go in a top-level `params` object: ```jsonc { "type": "action:button", "label": "New Account", "icon": "plus", - "action": { - "action": "navigate_create", - "params": { "objectName": "account" } - } + "actionType": "navigate_create", + "params": { "objectName": "account" } } ``` +`navigate_edit` additionally needs the record to open. `params` reaches +the handler verbatim: template expressions such as `${record.id}` are not +evaluated inside `params`, and `action:button` does not inject the +surrounding row, so a declared `navigate_edit` button carries a literal +`recordId`: + ```jsonc { "type": "action:button", "label": "Edit", "icon": "pencil", - "action": { - "action": "navigate_edit", - "params": { - "objectName": "account", - "recordId": "${record.id}" - } + "actionType": "navigate_edit", + "params": { + "objectName": "account", + "recordId": "0015e000abcd" } } ``` +For a per-row **Edit** that follows the record under the cursor, use the +list or detail view's built-in **Edit** entry point instead: under +`editMode: "page"` it already routes to the same URL (see *Migrating an +existing object* below). + When invoked from inside an `ObjectView`, the action context already -carries the active `objectName`, so `objectName` may be omitted from the -`params`: +carries the active `objectName`, so `params` may be omitted entirely: ```jsonc { "type": "action:button", "label": "New", - "action": { "action": "navigate_create" } + "actionType": "navigate_create" } ```