Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 6cf5999

Browse files
fix(components): action:bar / action:group / action:menu members evaluate properties.params like a top-level action:button (objectui#10290) (#10786)
Fixes #10290 Clause-②: yes (widening) ## What changed - `action:bar` evaluates an inline member's `properties` where it composes the member for `action:button` / `action:icon` (`withEvaluatedProperties` in `static-params.ts`). An overflow member goes to the bar's `action:menu` as authored, and that renderer evaluates it when it runs it, so no value is evaluated twice. - `action:group` and `action:menu` read an item's `properties.params`, evaluated with the same evaluator (`readMemberStaticParamValues`), and forward it as `ActionDef.params`. An item that carries an `ActionParam[]` list forwards both channels, as `action:button` does. A node-level object `params` keeps its objectui#10462 handling: dropped with one development warning; the `type: 'api'` window is unchanged when the item carries no `properties.params`; when it carries both, `properties.params` is forwarded and the node-level object is dropped without a warning. - `@object-ui/react`: the memo's per-key rule, its scope builder and its `properties` loop move from the memo closure to module scope in `SchemaRenderer.tsx` (`evaluateConfigValueWith`, `configEvaluationScope`, `evaluateConfigBagWith`). The memo calls them; its behaviour is unchanged. New exports: `useConfigBagEvaluator()` (`hooks/useConfigBagEvaluator.ts`) and its plain half `evaluateConfigBagInScope()` (`SchemaRenderer.tsx`). **File-surface widening, declared:** the route needs these exports. - Changeset `.changeset/10290-container-member-params-evaluated.md`: `@object-ui/components` patch, `@object-ui/react` minor (Clause-② widening: two new public exports; the fixed group releases at that minor). ## H1: premise, measured on base `17b323e5ca` Instrument: a one-off probe (not committed) that printed each handler's `params`, then the committed pin file run at the base in a detached control worktree. The page is a record page bound through `RecordContextProvider` to `{ id: 'rec_1' }`. The member is authored `properties.params: { objectName: 'account', recordId: '${record.id}' }`, and the handler is `navigate_edit`. | path | `params` the handler received | template evaluated | |---|---|---| | CONTROL: top-level `action:button` through `SchemaRenderer` | `{ objectName: 'account', recordId: 'rec_1' }` | yes | | `action:bar` inline member | `{ objectName: 'account', recordId: '${record.id}' }` | no, raw | | `action:bar` member, `component: 'action:group'` | same raw object | no, raw | | `action:bar` member, `component: 'action:menu'` (overflow) | `undefined` | values dropped | | `action:bar` member spilled past `maxVisible` | `undefined` | values dropped | | `action:group`, inline display | `undefined` | values dropped | | `action:group`, dropdown display | `undefined` | values dropped | | `action:menu` | `undefined` | values dropped | The `component: 'action:icon'` bar row was added to the pin after the probe. It is red on base in the pin run below. So PR objectui#10460 evaluates on none of the three containers, and the premise holds. The overflow, group and menu paths did not read `properties.params` at all. ## H2: the evaluator and the route - **The evaluator.** Inside `SchemaRenderer`'s `evaluatedSchema` memo, `evaluateConfigValue(key, value)` does the work. A `params` bag goes through `mapParamsLeaves` (`utils/paramsBag.ts`) with a visitor that calls `evaluator.evaluate` on each string leaf. Any other value goes through `ExpressionEvaluator.evaluate` per value, with a CEL envelope preserved and a data object passed through. `evaluator` is `new ExpressionEvaluator(scope)` from `@object-ui/core`. Its scope is the ambient predicate scope, plus `current_user` (an alias of `user`), plus `record` (the RecordContext row, only when one is bound), plus `page` (page variables). None of this was exported before this PR. - **Route (a) taken:** each container calls that rule with that scope. - **Route (b) not viable.** Dropdown items (the `action:group` dropdown, `action:menu`, and the bar overflow) are `DropdownMenuItem` leaves, not registry nodes, so `SchemaRenderer` cannot mount them. For inline members, (b) would also run the `properties` hoist on each member, a second run of the node visibility and enablement gate, and the `data-obj-*` and style plumbing. That is a wider behaviour change than the card asks for. - **Scope each container has at hand.** Four sources: the host's `data` row prop (what the members' `visible` / `disabled` predicates bind as `record`), the RecordContext row, page variables and the ambient predicate scope. The last three are the contexts `SchemaRenderer` reads, and the containers render under the same providers. `useConfigBagEvaluator` reads exactly the memo's three inputs. So a member's templates bind the RecordContext row, as a top-level `action:button`'s do. The `data` prop is not bound into the template scope, and `SchemaRenderer` does not bind it either. - **Why the hook lives in `hooks/` and not in `SchemaRenderer.tsx`.** Measured: a hook declared in `SchemaRenderer.tsx` puts that file under the React Compiler lint. The lint then reports three pre-existing render-time `performance.now()` / `Date.now()` debug probes as `react-hooks/purity` errors (0 without the hook, 3 with it). ## H3: `visible` / `disabled` on these paths Measured on base with a one-off probe on the same 7 paths plus the control. The predicates were `record.id == 'rec_1'` (true on the page), `record.id == 'rec_2'` (false), `disabled: record.id == 'rec_1'`, and the template form `${record.id == 'rec_1'}`. - **With the host's `data` row passed** (as `DetailView` passes `data={data}`): all 8 rows evaluate correctly. True renders, false is absent, disabled-true is disabled, and the template form renders. This is identical to the control. These gates are evaluated already, and nothing was widened. - **Without a `data` row** (RecordContext only): `record` is unbound on the predicate tier, which binds `record` from the `data` prop through `usePredicateRecordContext`. The predicates fault: fail-closed (absent) on the `action:button` / `action:menu` leaves, fail-soft (shown) on the `action:group` leaves. The control top-level `action:button` does the same. This is not container-specific. It is recorded under Acceptance notes, with no card. ## Pins and ablation New file `packages/components/src/renderers/action/__tests__/action-container-member-params-10290.test.tsx`, 17 tests: - CONTROL: a top-level `action:button` through `SchemaRenderer` resolves `${record.id}`. Green on base and head. - 8 paths × "the handler receives `properties.params` with `${record.id}` resolved". The paths are: bar inline, bar `action:icon`, bar group-placed, bar menu-placed, bar spilled past `maxVisible`, group inline, group dropdown, and menu. - 8 paths × "a node-level `params` OBJECT is still not a values channel, and says so once" (ruling A). Red on base, green on head: - base `17b323e5ca` (control worktree, same test file): `Tests 8 failed | 9 passed (17)`. The 8 failures are exactly the 8 "resolved" rows. The control and the 8 node-level rows are green. - head `e8b96c0161`: `Tests 17 passed (17)`. Ablation: one leg, through objectstack `scripts/ablation-replace.mjs` in WRAP mode, on the committed head. In `packages/react/src/hooks/useConfigBagEvaluator.ts`, the anchor `evaluateConfigBagInScope(bag, predicateScope, boundRecord, pageVariables);` became `bag; /* ABLATION-10290 */`, so the hook hands the bag back unevaluated. - Predicted: the 8 resolved rows go red, and the control and node-level rows stay green. - Observed: anchor 1 → 0, blob `8b01c529` → `f4c00a8f`, and `Tests 8 failed | 9 passed (17)`. - Restore: blob == HEAD `8b01c529`, and `git diff HEAD` is empty. - No build leg: the suite resolves `@object-ui/react` through the root `vitest.config.mts` alias to `packages/react/src`, so the mutated source is what ran. ## Gates At head `e8b96c0161` unless noted. - **vitest union** (repo root): `packages/components/src/renderers/action/`, `packages/react/`, and the scripts tests for check-action-forward-parity (plus its closing-keyword test), check-doc-expression-carriage and check-component-surface-parity. Result: `Test Files 130 passed (130)`, `Tests 1883 passed (1883)`, lock `VERDICT command-exit 0`. - **`type-check`** (`tsc --noEmit && tsc -p tsconfig.test.json`) for `@object-ui/react` and `@object-ui/components`: Done / Done at `a60555f057`, after `pnpm --filter @object-ui/react build`. The only later commit is changeset text. - The components test tsconfig includes the new pin file (`--listFilesOnly` count 1). - `dist/hooks/useConfigBagEvaluator.d.ts` is the only declaration of the hook in `dist`, so the green components type-check read the rebuilt `.d.ts`. - **eslint** on the 8 changed `.ts` / `.tsx` files, with inline config on (as `eslint .` runs per package): 0 errors, 48 warnings. - Population: the root `eslint.config.js` has `files: ['**/*.{ts,tsx}']`, and there is no package-level config in `packages/react` or `packages/components`. - File count: 8, from `--format json`. - No type-aware linting is configured (no `parserOptions.project` or `projectService`), so this diff cannot move a verdict on an untouched file. - The same 5 pre-existing files at base: 0 errors, 49 warnings. `SchemaRenderer.tsx` has 2 fewer `no-explicit-any` and 1 more `react-refresh/only-export-components` (for the new plain export). - **Green:** - `check:action-forward-parity`, `check:new-line-citations` (0 new), `check:control-bytes`, `check:handler-key-reads`, `check:self-import`. - `check:unreferenced-sources`, `check:phantom-deps`, `check:unused-deps`, `check:side-effects-array`, `check:component-surface-parity` (report-only). - `check:changeset-claims` (report-only). The four pending changesets it names for `SchemaRenderer.tsx` were read, and none is falsified. - `check:pending-changeset-literals`, `check:test-path-roots`, `check:vi-mock-specifiers`, `check-changeset-presence.mjs`, `check-changeset-no-major.mjs`, `check-doc-expression-carriage.mjs`. - **NOT MEASURED:** `check:eager-closure`. Reason: exit 2, PREREQUISITE NOT MET. There is no `apps/console/dist/eager-closure.json`, which needs a console build. Declared to CI. - **CI's runs:** repo-wide `pnpm lint` and the full `pnpm test`. ## Serial - PR objectui#8941, head `bb7d5e71`, was fetched into a private ref. `git merge-tree --write-tree` of HEAD against it exits 0 with no conflicts. It touches `action-bar.tsx`, and the merge is clean. - `origin/main` at `bf14b646` (5 commits past the base): merge-tree exits 0. None of those commits touch this PR's files, so there is no merge commit. ## Acceptance notes - **Docs.** `content/docs/guide/record-edit-modes.md` teaches `properties.params` on a top-level `action:button` only. The same authoring now works on a container member. The guide was not edited, because it is outside this order's file surface. If it is extended, it needs one caveat: the development-build unevaluated-expression diagnostic runs in the `SchemaRenderer` memo, so an unresolvable template on a container member reaches the handler raw without that report. Carrier: none named. - **Boundary.** `element:button`'s inline `action` and `page:header`'s actions still read no `properties.params`. They are objectui#10462 surfaces, not containers. - **Boundary.** Take an `action:bar` member of `type: 'api'` with an object `params`. The overflow `action:menu` reads it (the objectstack#5777 window, entry semantics), and the inline path ignores it (`action:button` semantics). This dates from objectui#10460 and objectui#10462, and is not changed here. - **Observation (H3).** The predicate tier binds `record` from the host's `data` prop, and the template tier binds it from RecordContext. On a host that provides RecordContext but no `data`, a `record.*` predicate faults while a `record.*` template resolves. This predates this PR and is identical on a top-level `action:button`. It was not measured on a real host page. - The two new `@object-ui/react` exports are declared `minor` (Clause-② widening). Session: `https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN` --- _Generated by [Claude Code](https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fb336df commit 6cf5999

9 files changed

Lines changed: 509 additions & 43 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
'@object-ui/components': patch
3+
'@object-ui/react': minor
4+
---
5+
6+
fix(components): an action container's members evaluate `properties.params` the way a top-level `action:button` does
7+
8+
A member of `action:bar`, `action:group` or `action:menu` never passes through
9+
`SchemaRenderer`, so the evaluation that resolves `"recordId": "${record.id}"`
10+
in a node's `properties.params` did not run for it. On a record page an
11+
`action:bar` member drawn inline handed its `navigate_edit` handler the raw
12+
`${record.id}` text, and a member that the bar placed in its overflow menu, or
13+
an `action:group` / `action:menu` item, did not forward its `properties.params`
14+
at all.
15+
16+
Each container now evaluates its members' `properties` with the evaluator and
17+
scope `SchemaRenderer` uses: `action:bar` where it composes an inline member,
18+
and `action:group` / `action:menu` when they run an item. A container member's
19+
static values therefore reach the handler as a top-level `action:button`'s do,
20+
with one difference: the development-build unevaluated-expression diagnostic
21+
runs in the `SchemaRenderer` memo, so it does not report an unresolvable
22+
template on a container member. An item that carries an `ActionParam[]` input
23+
list forwards both, as `action:button` does. A node-level `params` object is
24+
still not read as values (objectui#10289). The one exception is unchanged from
25+
objectui#10462: an `action:group` / `action:menu` item of `type: 'api'` still
26+
forwards it as the request payload (objectstack#5777 window), unless the item
27+
also carries a `properties.params` bag, which now takes precedence.
28+
29+
`@object-ui/react` exports `useConfigBagEvaluator()` for this. It returns a
30+
function that applies the `SchemaRenderer` memo's `properties` evaluation (the
31+
same per-key rule and the same `record` / `current_user` / `page` scope) to a
32+
config bag rendered without `SchemaRenderer`. It is not a second template
33+
engine. Its plain half, `evaluateConfigBagInScope()`, is exported beside
34+
`SchemaRenderer`. Both are built from the module-scope scope builder and
35+
per-key rule that the memo itself calls.
36+
37+
Declared as a minor (Clause-②, widening): `@object-ui/react` gains two public
38+
exports, `useConfigBagEvaluator` and `evaluateConfigBagInScope`. Nothing is
39+
removed or renamed.
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/**
10+
* objectui#10290: a member of an action CONTAINER (`action:bar`,
11+
* `action:group`, `action:menu`) carries its static execution values in
12+
* `properties.params` (objectui#10289, ruling A), and those values are
13+
* templates evaluated where `properties` are (objectui#7867, ruling A). A
14+
* container member never passes through the `SchemaRenderer` evaluation memo,
15+
* so each container evaluates its members' `properties` through the evaluator
16+
* that memo uses, against the scope that memo builds.
17+
*
18+
* Driven end to end through the real pieces: the real `SchemaRenderer` renders
19+
* the real container, the click or menu selection goes through the real
20+
* `ActionRunner`, and the value asserted is the `params` on the `ActionDef` the
21+
* registered `navigate_edit` handler receives. The row is bound the way a
22+
* record page binds it, through `RecordContextProvider`.
23+
*
24+
* The CONTROL is a top-level `action:button` with the same `properties.params`.
25+
* It goes through the `SchemaRenderer` memo, so it resolved before this change
26+
* too: a red container row beside a green control means the container, never
27+
* an unbound `record` root.
28+
*/
29+
30+
import { describe, it, expect, vi, beforeEach, afterEach, type Mock } from 'vitest';
31+
import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';
32+
import '@testing-library/jest-dom';
33+
import React from 'react';
34+
import type { ActionContext, ActionDef, ActionResult } from '@object-ui/core';
35+
import type { BaseSchema } from '@object-ui/types';
36+
import { ActionProvider, RecordContextProvider, SchemaRenderer } from '@object-ui/react';
37+
// Module-scope side-effect imports: `action:bar` resolves its members and its
38+
// overflow menu through the ComponentRegistry at render time, and the light
39+
// `dom` project does not load the components graph. Module scope, not a
40+
// `beforeAll`, per AGENTS.md 测试纪律.
41+
import '../action-bar';
42+
import '../action-button';
43+
import '../action-icon';
44+
import '../action-menu';
45+
import '../action-group';
46+
import { resetStaticParamsWarnings } from '../static-params';
47+
48+
const ROW = { id: 'rec_1', name: 'Acme' };
49+
50+
/** The authored values: one template leaf, one literal leaf. */
51+
const AUTHORED = { objectName: 'account', recordId: '${record.id}' };
52+
53+
/** What the handler must receive once the template is evaluated. */
54+
const RESOLVED = { objectName: 'account', recordId: 'rec_1' };
55+
56+
/** The overflow trigger's accessible name, with no i18n bundle loaded. */
57+
const MORE = 'More actions';
58+
59+
let navigateEdit: Mock<(action: ActionDef, ctx: ActionContext) => Promise<ActionResult>>;
60+
let warn: ReturnType<typeof vi.spyOn>;
61+
let consoleError: ReturnType<typeof vi.spyOn>;
62+
63+
beforeEach(() => {
64+
navigateEdit = vi.fn(async () => ({ success: true }));
65+
warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
66+
consoleError = vi.spyOn(console, 'error').mockImplementation(() => {});
67+
resetStaticParamsWarnings();
68+
});
69+
70+
afterEach(() => {
71+
warn.mockRestore();
72+
consoleError.mockRestore();
73+
});
74+
75+
/** One member action, as an author writes it inside a container's `actions`. */
76+
function member(extra: Record<string, unknown> = {}): Record<string, unknown> {
77+
return { name: 'edit', label: 'Edit', type: 'navigate_edit', ...extra };
78+
}
79+
80+
/** Render `schema` on a record page bound to {@link ROW}. */
81+
function renderOnRecordPage(schema: Record<string, unknown>) {
82+
return render(
83+
<ActionProvider handlers={{ navigate_edit: navigateEdit }}>
84+
<RecordContextProvider objectName="account" recordId={ROW.id} data={ROW}>
85+
<SchemaRenderer schema={schema as unknown as BaseSchema} />
86+
</RecordContextProvider>
87+
</ActionProvider>,
88+
);
89+
}
90+
91+
/** Radix opens a dropdown on `pointerdown` and mounts its content in a portal. */
92+
async function selectFromMenu(trigger: HTMLElement, label: string) {
93+
fireEvent.pointerDown(trigger, { button: 0, ctrlKey: false, pointerType: 'mouse' });
94+
const menu = await screen.findByRole('menu');
95+
fireEvent.click(within(menu).getByRole('menuitem', { name: label }));
96+
}
97+
98+
/** How the member is reached once its container is on screen. */
99+
type Reach = (label: string) => Promise<void>;
100+
101+
const clickButton: Reach = async (label) => {
102+
fireEvent.click(screen.getByRole('button', { name: label }));
103+
};
104+
105+
const viaTrigger = (triggerName: string): Reach => async (label) => {
106+
await selectFromMenu(screen.getByRole('button', { name: triggerName }), label);
107+
};
108+
109+
/** Every path a container member reaches the runner by. */
110+
const CONTAINERS: ReadonlyArray<{
111+
path: string;
112+
schema: (m: Record<string, unknown>) => Record<string, unknown>;
113+
reach: Reach;
114+
}> = [
115+
{
116+
path: 'action:bar, inline member',
117+
schema: (m) => ({ type: 'action:bar', actions: [m] }),
118+
reach: clickButton,
119+
},
120+
{
121+
path: 'action:bar, member drawn as an icon (`component: action:icon`)',
122+
schema: (m) => ({ type: 'action:bar', actions: [{ ...m, component: 'action:icon' }] }),
123+
reach: clickButton,
124+
},
125+
{
126+
path: 'action:bar, member placed in a button group (`component: action:group`)',
127+
schema: (m) => ({ type: 'action:bar', actions: [{ ...m, component: 'action:group' }] }),
128+
reach: clickButton,
129+
},
130+
{
131+
path: 'action:bar, member placed in the overflow menu (`component: action:menu`)',
132+
schema: (m) => ({ type: 'action:bar', actions: [{ ...m, component: 'action:menu' }] }),
133+
reach: viaTrigger(MORE),
134+
},
135+
{
136+
path: 'action:bar, member spilled past `maxVisible` into the overflow menu',
137+
schema: (m) => ({
138+
type: 'action:bar',
139+
maxVisible: 1,
140+
mobileMaxVisible: 1,
141+
actions: [{ name: 'first', label: 'First', type: 'navigate_edit' }, m],
142+
}),
143+
reach: viaTrigger(MORE),
144+
},
145+
{
146+
path: 'action:group, inline display',
147+
schema: (m) => ({ type: 'action:group', actions: [m] }),
148+
reach: clickButton,
149+
},
150+
{
151+
path: 'action:group, dropdown display',
152+
schema: (m) => ({ type: 'action:group', display: 'dropdown', label: 'Group', actions: [m] }),
153+
reach: viaTrigger('Group'),
154+
},
155+
{
156+
path: 'action:menu',
157+
schema: (m) => ({ type: 'action:menu', actions: [m] }),
158+
reach: viaTrigger(MORE),
159+
},
160+
];
161+
162+
/** Mount, reach the member, return the `params` the handler received. */
163+
async function paramsReceived(schema: Record<string, unknown>, reach: Reach): Promise<unknown> {
164+
renderOnRecordPage(schema);
165+
await reach('Edit');
166+
await waitFor(() => expect(navigateEdit).toHaveBeenCalledTimes(1));
167+
return (navigateEdit.mock.calls[0][0] as ActionDef).params;
168+
}
169+
170+
describe('objectui#10290 - a container member\'s `properties.params` is evaluated where `properties` are', () => {
171+
it('CONTROL: a top-level `action:button` resolves `${record.id}` through the SchemaRenderer memo', async () => {
172+
const params = await paramsReceived(
173+
{
174+
type: 'action:button',
175+
name: 'edit',
176+
label: 'Edit',
177+
actionType: 'navigate_edit',
178+
properties: { params: AUTHORED },
179+
},
180+
clickButton,
181+
);
182+
expect(params).toEqual(RESOLVED);
183+
});
184+
185+
describe.each(CONTAINERS)('$path', ({ schema, reach }) => {
186+
it('the handler receives `properties.params` with `${record.id}` resolved', async () => {
187+
const params = await paramsReceived(schema(member({ properties: { params: AUTHORED } })), reach);
188+
expect(params).toEqual(RESOLVED);
189+
});
190+
191+
it('a node-level `params` OBJECT is still not a values channel, and says so once (objectui#10289)', async () => {
192+
const params = await paramsReceived(schema(member({ params: AUTHORED })), reach);
193+
expect(params).toBeUndefined();
194+
const lines = warn.mock.calls
195+
.map((c: unknown[]) => String(c[0]))
196+
.filter((m: string) => m.includes('action "edit"') && m.includes('`params`'));
197+
expect(lines).toHaveLength(1);
198+
});
199+
});
200+
});

‎packages/components/src/renderers/action/action-bar.tsx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ import React, { forwardRef, useMemo } from 'react';
5151
import { ComponentRegistry } from '@object-ui/core';
5252
import type { UIActionSchema, ActionLocation, ActionComponent } from '@object-ui/types';
5353
import { ACTION_LOCATIONS, actionRendersAt } from '@object-ui/types';
54-
import { useCondition, toPredicateInput, useCapabilityGate } from '@object-ui/react';
54+
import { useCondition, toPredicateInput, useCapabilityGate, useConfigBagEvaluator } from '@object-ui/react';
5555
import { useObjectTranslation } from '@object-ui/i18n';
5656
import { cn } from '../../lib/utils';
5757
import { useIsMobile } from '../../hooks/use-mobile';
5858
import { ButtonGroup } from '../../custom/button-group';
59+
import { withEvaluatedProperties } from './static-params';
5960

6061
function useActionsLabel(): string {
6162
// useObjectTranslation is provider-safe (never throws); no try/catch, which
@@ -157,6 +158,9 @@ const ActionBarRenderer = forwardRef<HTMLDivElement, { schema: ActionBarSchema;
157158
const isMobile = useIsMobile();
158159
// [ADR-0066 D4 / framework#3923] Shared capability gate — see below.
159160
const mayInvoke = useCapabilityGate();
161+
// The `SchemaRenderer` memo's `properties` evaluation, for the members this
162+
// bar draws itself (objectui#10290) — see `renderMember` below.
163+
const evaluateBag = useConfigBagEvaluator();
160164

161165
// Filter business actions by location and deduplicate by name
162166
const filteredActions = useMemo(() => {
@@ -327,6 +331,14 @@ const ActionBarRenderer = forwardRef<HTMLDivElement, { schema: ActionBarSchema;
327331
// One inline member, drawn by the renderer `componentType` names. The whole
328332
// action is spread onto that renderer's schema, so it carries its own gates
329333
// and its `autoTrigger` with it.
334+
//
335+
// The member is mounted without `SchemaRenderer`, so nothing else evaluates
336+
// its `properties`: its static values (`properties.params`, objectui#10289)
337+
// would reach the handler as raw `${…}` text. They are evaluated here, once,
338+
// with the memo's evaluator and scope (objectui#10290). An overflow member
339+
// is NOT evaluated here: it goes to the `action:menu` above as authored,
340+
// and that renderer evaluates it when it runs it, so no value is evaluated
341+
// twice.
330342
const renderMember = (action: UIActionSchema, componentType: ActionComponent) => {
331343
const Renderer = ComponentRegistry.get(componentType);
332344
if (!Renderer) return null;
@@ -335,7 +347,7 @@ const ActionBarRenderer = forwardRef<HTMLDivElement, { schema: ActionBarSchema;
335347
<Renderer
336348
key={action.name}
337349
schema={{
338-
...action,
350+
...withEvaluatedProperties(action, evaluateBag),
339351
type: componentType,
340352
actionType: action.type,
341353
variant: action.variant || schema.variant,

‎packages/components/src/renderers/action/action-group.tsx‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type { ActionDef } from '@object-ui/core';
2222
import type { UIActionSchema, ActionLocation } from '@object-ui/types';
2323
import { actionRendersAt } from '@object-ui/types';
2424
import { useAction } from '@object-ui/react';
25-
import { useCondition, toPredicateInput, usePredicateRecordContext } from '@object-ui/react';
25+
import { useCondition, toPredicateInput, usePredicateRecordContext, useConfigBagEvaluator } from '@object-ui/react';
2626
import { Button } from '../../ui';
2727
import {
2828
DropdownMenu,
@@ -35,7 +35,7 @@ import { cn } from '../../lib/utils';
3535
import { Loader2, ChevronDown } from 'lucide-react';
3636
import { resolveIcon } from './resolve-icon';
3737
import { hasDeclaredVisibilityGate } from './visibility-gate';
38-
import { readActionEntryParamValues } from './static-params';
38+
import { readActionEntryParamValues, readMemberStaticParamValues } from './static-params';
3939

4040
export interface ActionGroupSchema {
4141
type: 'action:group';
@@ -227,6 +227,9 @@ const ActionGroupRenderer = forwardRef<HTMLDivElement, { schema: ActionGroupSche
227227
} = props;
228228

229229
const { execute } = useAction();
230+
// The `SchemaRenderer` memo's `properties` evaluation, for the member this
231+
// renderer runs itself (objectui#10290) — see `handleExecute`.
232+
const evaluateBag = useConfigBagEvaluator();
230233
const [dropdownLoading, setDropdownLoading] = useState(false);
231234

232235
// The row bound the three canonical ways — see `usePredicateRecordContext`.
@@ -261,9 +264,20 @@ const ActionGroupRenderer = forwardRef<HTMLDivElement, { schema: ActionGroupSche
261264
// an array is forwarded as `actionParams`, as `action:button` does. An
262265
// object is forwarded as values only for `type: 'api'`, the objectstack#5777
263266
// payload window; any other type drops it (objectui#10462).
267+
//
268+
// The member's static values ride `properties.params`, as on
269+
// `action:button`, and are evaluated here with the `SchemaRenderer` memo's
270+
// evaluator and scope: the member never passes through that memo
271+
// (objectui#10290). Independent of the input list, so both are forwarded.
272+
// They win over the `api` window's object `params`, as `properties.params`
273+
// wins over a node-level object on `action:button`.
274+
const staticValues = readMemberStaticParamValues(action, evaluateBag);
275+
const entryValues = Array.isArray(action.params)
276+
? undefined
277+
: readActionEntryParamValues(action, action.type, 'action:group');
264278
const paramsPayload: ActionDef = Array.isArray(action.params)
265-
? { actionParams: action.params as any }
266-
: { params: readActionEntryParamValues(action, action.type, 'action:group') };
279+
? { actionParams: action.params as any, params: staticValues }
280+
: { params: staticValues !== undefined ? staticValues : entryValues };
267281
await execute({
268282
type: action.type,
269283
name: action.name,
@@ -309,7 +323,7 @@ const ActionGroupRenderer = forwardRef<HTMLDivElement, { schema: ActionGroupSche
309323
objectName: (action as any).objectName,
310324
});
311325
},
312-
[execute],
326+
[execute, evaluateBag],
313327
);
314328

315329
// Dropdown items share the trigger's loading spinner, so wrap execution to

0 commit comments

Comments
 (0)