From d1fd57f834de12fe63bd8d2230e0bdf9727d7365 Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Mon, 22 Jun 2026 14:55:19 +0800 Subject: [PATCH] fix(showcase): hide Mark Done once the task is complete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mark Done lingered on already-done records and re-firing it was a silent no-op ("why is it still here?"). Gate the action with `visible: '!record.done'` — the `done` boolean this action sets, so the button disappears after a successful click and stays hidden on finished tasks. The `record.`-prefix is required: the ActionEngine filters a record-header action's `visible` against `{ record, recordId, objectName, user }` with fail-closed semantics (`throwOnError: true` → catch → hide). A bare `done` / `status` predicate is not at the top level of that context, so it throws and the action is hidden on EVERY record (the trap an earlier attempt hit). A single operand is also deliberate — the renderer wraps `visible` as a `${...}` template whose evaluator throws on compound `&&` / `||`. Verified in-browser against a current console: shows on active tasks, hides on done tasks; clicking it flips `done` and the button is gone on reload. Co-Authored-By: Claude Opus 4.8 --- examples/app-showcase/src/actions/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/app-showcase/src/actions/index.ts b/examples/app-showcase/src/actions/index.ts index 069ee8cf48..b263d1ff1b 100644 --- a/examples/app-showcase/src/actions/index.ts +++ b/examples/app-showcase/src/actions/index.ts @@ -41,6 +41,14 @@ export const MarkDoneAction = defineAction({ capabilities: ['api.write'], }, successMessage: 'Task marked done.', + // Hide once the task is complete. Gate on `record.done` (the boolean this + // action sets) so the button vanishes after a successful click and stays + // hidden on finished records (the "why is it still here?" report). NOTE the + // `record.`-prefix: the ActionEngine evaluates a record-header action's + // `visible` against `{ record, recordId, … }` with fail-closed semantics, so + // a bare `done`/`status` throws (field not at top level) and silently hides + // the action. Single operand, too — the template path throws on `&&`/`||`. + visible: '!record.done', // `record_section` so the Task Detail page's `record:quick_actions` bar // (which names this action) resolves it — the engine location-filters even // explicitly-named actions, mirroring the platform's own sys-user pages.