Skip to content

Commit a83d2b4

Browse files
xuyushun441-sysos-zhuangclaude
authored
fix(showcase): hide Mark Done once the task is complete (#2183)
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: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ce13bb8 commit a83d2b4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • examples/app-showcase/src/actions

‎examples/app-showcase/src/actions/index.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ export const MarkDoneAction = defineAction({
4141
capabilities: ['api.write'],
4242
},
4343
successMessage: 'Task marked done.',
44+
// Hide once the task is complete. Gate on `record.done` (the boolean this
45+
// action sets) so the button vanishes after a successful click and stays
46+
// hidden on finished records (the "why is it still here?" report). NOTE the
47+
// `record.`-prefix: the ActionEngine evaluates a record-header action's
48+
// `visible` against `{ record, recordId, … }` with fail-closed semantics, so
49+
// a bare `done`/`status` throws (field not at top level) and silently hides
50+
// the action. Single operand, too — the template path throws on `&&`/`||`.
51+
visible: '!record.done',
4452
// `record_section` so the Task Detail page's `record:quick_actions` bar
4553
// (which names this action) resolves it — the engine location-filters even
4654
// explicitly-named actions, mirroring the platform's own sys-user pages.

0 commit comments

Comments
 (0)