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

Commit 2e3da72

Browse files
fix(components): action:menu and action:group take the host's disabled by name (objectui#11182) (#11221)
Fixes #11182 Clause-②: no Implemented by `os-dev` in session `https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ`, dispatched under claim comment 5912386098 (`domain:ui#1`). ## What changed `action:menu` and `action:group` now take the host's forwarded `disabled` by name. This is the objectui#9131 rule `action:button` and `action:icon` already follow. There is one convention and no new helper. - **`action:menu`** destructures `disabled: hostDisabled` off the props, so `...rest` no longer carries a `disabled` key. The trigger is `disabled={hostDisabled || loading}`. The menu declares no enablement gate of its own: the renderer reads none, the registry `inputs` publish none, and `ActionMenuPropsSchema` in `@objectstack/spec` 17.5.0 declares no `disabled` or `enabled`. So none was invented. - **`action:group`** destructures `disabled: hostDisabled` the same way. Inline mode hands it to every `InlineActionButton`, where it leads the OR: `hostDisabled || (declared gate) || loading`. Dropdown mode puts it on the trigger: `hostDisabled || dropdownLoading`. The wrapping div no longer receives it. - Both parameter annotations declare `disabled?: boolean`, as `ActionButtonRendererProps` does. The annotation is inline and not exported, so no public type changes. - Changeset: `@object-ui/components` patch. ## The defect, measured red before any source edit `SchemaRenderer` forwards `disabled: __disabled || undefined`. The key is always present and only the value is conditional. `action:menu` wrote `disabled={loading}` and then spread `{...rest}`, so the forwarded `undefined` overwrote the in-flight verdict. The new pin was run on the untouched tree first. Its in-flight row read: ``` direct: { spinning: true, disabled: true } node: { spinning: true, disabled: false } ``` That is the card's probe reading exactly. A menu rendered through `SchemaRenderer` showed its spinner while its trigger stayed pressable. ## action:group, measured in the same pass A scratch probe used the real `SchemaRenderer` and an inline group with `disabled: true` on the node. It was deleted after the run. Its reading on the untouched tree: ``` hostDisabled true -> wrapper DIV, disabled attribute "", member button disabled false hostDisabled none -> wrapper DIV, no disabled attribute, member button disabled false ``` So the forwarded `disabled` did reach the wrapper, where it disables nothing. In dropdown mode the host verdict was dropped, and the trigger stayed pressable. Both modes reproduced red in the new pin before the fix. The in-flight half does not reproduce on the group. The dropdown trigger never spread `rest`, and inline members keep their own loading state. So only the host-disabled half was changed. ## Tests New `packages/components/src/renderers/action/__tests__/action-menu-host-disabled-11182.test.tsx`. It uses the real `SchemaRenderer`, the real registry, and an `api` handler held in flight until the test settles it: - In-flight member: the trigger is disabled on both channels (direct registry mount and `SchemaRenderer`), read as one object, and it re-enables on both when the action settles. - A host-disabled menu stays disabled. This covers a node `disabled: true`, a node predicate, and `properties.disabled`. - A menu the host disables while its action runs stays disabled after the action settles. - An idle menu with no gate, or with a false predicate, is pressable on both channels. - Group, inline: every member is disabled, and the wrapper carries no `disabled` attribute. Group, dropdown: the trigger is disabled. With no gate or a false gate, both modes are pressable. **Red before the fix** (commit `cfc9b6db98`, test staged, no source edit): 3 failed, 4 passed (7). The failures were the in-flight row and the two host-disabled group rows. **Ablation** was run from the committed fix on `06e5657081`. Each leg overwrote the file, printed anchor counts, ran the file, then restored from `HEAD` under a trap. Each restore was proven by blob hashes equal to `HEAD` and an empty `git diff HEAD`. | Leg | Anchor counts after the edit | Result | |---|---|---| | `action-menu.tsx` at base | `hostDisabled` 0, `disabled={loading}` 1 | 1 failed: the in-flight row | | `action-group.tsx` at base | `hostDisabled` 0, `disabled={dropdownLoading}` 1 | 2 failed: the inline and dropdown rows | | menu keeps the destructure, drops `hostDisabled` from the OR | OR 0, `disabled={loading}` 1 | 2 failed: the two host-disabled menu rows | ## Local gates Commands and results: - `pnpm --workspace-concurrency=2 --filter '@object-ui/components^...' build` exited 0 (7 packages). - `pnpm --filter @object-ui/components type-check` exited 0 on `06e5657081`. `tsc -p tsconfig.test.json --listFiles` lists the new test file. - `pnpm exec vitest run packages/components/src/renderers/action/` plus the two `packages/react` pins (`SchemaRenderer.disabledDeclaredGate.test.tsx`, `SchemaRenderer.enablementEnvelopeConfigBag.test.tsx`) on `06e5657081`: Test Files 32 passed (32), Tests 530 passed (530). - `pnpm exec vitest run packages/components/ --maxWorkers=2` on `b9967bba99`: Test Files 342 passed, 1 skipped (343). The later commits change only the new test file and the changeset, and the action-directory run above covers that test file. - On `809de9ca8e` (HEAD), all exited 0: `node scripts/check-changeset-presence.mjs`, `pnpm check:control-bytes`, `pnpm check:new-line-citations` (0 new citations), `pnpm check:changeset-claims`, `pnpm check:pending-changeset-literals`, `node scripts/check-changeset-no-major.mjs`. - On `06e5657081`, both exited 0: `pnpm check:action-forward-parity`, `pnpm check:test-path-roots`. - ESLint on the three touched sources: 0 errors. The warning counts equal the base versions (menu 11, group 15, all pre-existing `no-explicit-any`), and the new test has 0. The root config uses `tseslint.configs.recommended` with no `parserOptions.project` or `projectService`, and no rule in `eslint-rules/` reads the filesystem, so this diff cannot move the verdict of an untouched file. The full `pnpm lint` run is left to CI. ## Acceptance notes These were read from source and not measured. They were not filed: - `action:menu` still spreads the raw `rest` onto the trigger, where `action:button` and `action:icon` pass it through `toFormControlDomProps`. The node's other keys therefore reach the trigger's props. The inline `action:group` wrapper receives its other keys the same way. Carrier: none. - `autoTrigger` members of a menu that is disabled from mount still run. `useAutoTriggerOnce` consults the action's `visible`, not the enablement verdict, which is the same as on `action:button`. This was seen once, on the menu only, by the first draft of the settle row. The row was then rewritten so it no longer depends on that behaviour. Carrier: none. objectui#11212 (the permission-predicate fault policy on `action:group` / `action:icon`) is serial behind this PR on `action-group.tsx`. No `visible` or `disabled` predicate fault policy was changed here. --- _Generated by [Claude Code](https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1263e40 commit 2e3da72

4 files changed

Lines changed: 315 additions & 8 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'@object-ui/components': patch
3+
---
4+
5+
fix(components): an `action:menu` trigger stays disabled while its action runs, and a disabled `action:group` disables its buttons (objectui#11182)
6+
7+
On a schema-rendered page, an `action:menu` whose action was still running showed its
8+
spinner but its trigger could still be pressed, so a second run could start (a duplicate
9+
record, a duplicate send). `SchemaRenderer` hands every component a `disabled` key, even
10+
when its value is `undefined`, and the menu spread that key over its own in-flight
11+
verdict. A menu mounted straight from the registry, which is how `action:bar` mounts its
12+
overflow menu, was not affected.
13+
14+
`action:group` lost the host's `disabled` verdict the same way. In inline mode it landed
15+
on the wrapping `div`, where it disables nothing. In dropdown mode it was dropped. A
16+
disabled group therefore left every member button (inline) or its trigger (dropdown)
17+
pressable.
18+
19+
Both renderers now read the host's `disabled` by name, as `action:button` and
20+
`action:icon` already did (objectui#9131). The menu trigger is disabled while the host
21+
says so or while an action is in flight. It re-enables when the action settles. A
22+
disabled group disables every inline member and its dropdown trigger. An idle menu, and
23+
a group that no host disables, behave as before.
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
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#11182 — `action:menu` and `action:group` take the host's forwarded
11+
* `disabled` by name, the objectui#9131 rule `action:button` and `action:icon`
12+
* already follow.
13+
*
14+
* ## The mechanism
15+
*
16+
* `SchemaRenderer` hands every component `disabled: __disabled || undefined`:
17+
* the key is always present, only its value is conditional. `action:menu` drew
18+
* its trigger with `disabled={loading}` and then spread `{...rest}` after it,
19+
* so the forwarded key wrote over the renderer's own in-flight verdict. On the
20+
* ordinary SDUI path the trigger of a menu whose action was still running read
21+
* `disabled=false`: the spinner showed, and a second execution could start.
22+
* A direct registry mount (the way `action:bar` mounts its overflow menu)
23+
* forwards no `disabled` at all, so that channel was right throughout — it is
24+
* the control here, not a casualty.
25+
*
26+
* `action:group` had the other half of the same shape. Inline mode spread the
27+
* forwarded key onto its wrapping `div`, where a `disabled` attribute does
28+
* nothing, and dropdown mode dropped it: a host-disabled group left every
29+
* member (inline) or its trigger (dropdown) pressable.
30+
*
31+
* ## What each block refuses
32+
*
33+
* • the in-flight block reads the trigger on BOTH channels as one object, so a
34+
* disagreement between them is the failure message itself (pre-fix it read
35+
* `node: { spinning: true, disabled: false }` beside a disabled `direct`);
36+
* • the settle rows refuse a fix that disables the trigger for good;
37+
* • the host-disabled rows refuse the other way to make the channels agree —
38+
* dropping the forwarded verdict instead of consuming it — including after
39+
* an action settles, which is the row an in-flight gate written after the
40+
* spread would fail;
41+
* • the no-gate rows refuse an over-correction into "always disabled".
42+
*/
43+
44+
import { describe, it, expect, vi, afterEach, type Mock } from 'vitest';
45+
import { render, screen, waitFor, cleanup, act } from '@testing-library/react';
46+
import '@testing-library/jest-dom';
47+
import React from 'react';
48+
import { ComponentRegistry } from '@object-ui/core';
49+
import type { ActionContext, ActionDef, ActionResult } from '@object-ui/core';
50+
import { ActionProvider, PredicateScopeProvider, SchemaRenderer } from '@object-ui/react';
51+
// Module-scope side-effect imports so both renderers are in the registry when
52+
// `ComponentRegistry.get` and `SchemaRenderer` resolve them (the light `dom`
53+
// project does not load the `@object-ui/components` graph), per AGENTS.md
54+
// §测试纪律 — the cost lands in the import phase, not under a hook timeout.
55+
import '../action-menu';
56+
import '../action-group';
57+
58+
type Handler = Mock<(action: ActionDef, ctx: ActionContext) => Promise<ActionResult>>;
59+
60+
/** The predicate scope the predicate rows resolve against. */
61+
const SCOPE = { features: { locked: true, unlocked: false } };
62+
63+
/** A handler whose run stays in flight until the test settles it. */
64+
function pendingHandler() {
65+
let settle: () => void = () => {};
66+
const api: Handler = vi.fn(
67+
() =>
68+
new Promise<ActionResult>((resolve) => {
69+
settle = () => resolve({ success: true });
70+
}),
71+
);
72+
return { api, settle: () => settle() };
73+
}
74+
75+
/**
76+
* The menu node. `label` names the trigger for `getByRole`; the one member runs
77+
* on mount through the menu's own execute path (`autoTrigger`), which is what
78+
* puts the menu in flight without opening the dropdown.
79+
*/
80+
function menuNode(member: Record<string, unknown> = {}, node: Record<string, unknown> = {}) {
81+
return {
82+
type: 'action:menu',
83+
label: 'More',
84+
actions: [{ name: 'run', label: 'Run', type: 'api', ...member }],
85+
...node,
86+
};
87+
}
88+
89+
const trigger = () => screen.getByRole('button', { name: 'More' }) as HTMLButtonElement;
90+
91+
/** What a user sees on the trigger: is it spinning, and can it be pressed? */
92+
function readTrigger() {
93+
const el = trigger();
94+
return { spinning: el.querySelector('.animate-spin') !== null, disabled: el.disabled };
95+
}
96+
97+
type Channel = 'direct' | 'node';
98+
99+
/** One menu on one channel, inside the handler and scope providers. */
100+
function tree(channel: Channel, schema: Record<string, unknown>, api: Handler) {
101+
let menu: React.ReactElement;
102+
if (channel === 'direct') {
103+
const Renderer = ComponentRegistry.get('action:menu');
104+
if (!Renderer) throw new Error('action:menu is not registered');
105+
menu = <Renderer schema={schema} />;
106+
} else {
107+
menu = <SchemaRenderer schema={schema as never} />;
108+
}
109+
return (
110+
<ActionProvider handlers={{ api }}>
111+
<PredicateScopeProvider scope={SCOPE}>{menu}</PredicateScopeProvider>
112+
</ActionProvider>
113+
);
114+
}
115+
116+
function mount(channel: Channel, schema: Record<string, unknown>, api: Handler) {
117+
return render(tree(channel, schema, api));
118+
}
119+
120+
/** The in-flight reading, then the settled reading, on one channel. */
121+
async function inFlightThenSettled(channel: Channel) {
122+
const { api, settle } = pendingHandler();
123+
mount(channel, menuNode({ autoTrigger: true }), api);
124+
await waitFor(() => expect(api).toHaveBeenCalledTimes(1));
125+
await waitFor(() => expect(readTrigger().spinning).toBe(true));
126+
const inFlight = readTrigger();
127+
await act(async () => {
128+
settle();
129+
});
130+
await waitFor(() => expect(readTrigger().spinning).toBe(false));
131+
const settled = readTrigger();
132+
cleanup();
133+
return { inFlight, settled };
134+
}
135+
136+
afterEach(() => {
137+
cleanup();
138+
vi.restoreAllMocks();
139+
});
140+
141+
describe('action:menu — the trigger keeps its own verdict through SchemaRenderer (objectui#11182)', () => {
142+
it('an in-flight member keeps the trigger disabled on both channels, and it re-enables when the action settles', async () => {
143+
const direct = await inFlightThenSettled('direct');
144+
const node = await inFlightThenSettled('node');
145+
expect({ direct: direct.inFlight, node: node.inFlight }).toEqual({
146+
direct: { spinning: true, disabled: true },
147+
node: { spinning: true, disabled: true },
148+
});
149+
expect({ direct: direct.settled, node: node.settled }).toEqual({
150+
direct: { spinning: false, disabled: false },
151+
node: { spinning: false, disabled: false },
152+
});
153+
});
154+
155+
it('a host-disabled menu stays disabled, through the node gate and through the properties bag', () => {
156+
const { api } = pendingHandler();
157+
for (const gate of [
158+
{ disabled: true },
159+
{ disabled: 'features.locked == true' },
160+
{ properties: { disabled: true } },
161+
]) {
162+
mount('node', menuNode({}, gate), api);
163+
expect(readTrigger()).toEqual({ spinning: false, disabled: true });
164+
cleanup();
165+
}
166+
expect(api).not.toHaveBeenCalled();
167+
});
168+
169+
it('a menu the host disables while its action runs stays disabled after the action settles', async () => {
170+
// The action starts on an enabled menu, so this row does not lean on
171+
// whether `autoTrigger` runs on a menu that is disabled from the start.
172+
const { api, settle } = pendingHandler();
173+
const view = mount('node', menuNode({ autoTrigger: true }), api);
174+
await waitFor(() => expect(readTrigger().spinning).toBe(true));
175+
view.rerender(tree('node', menuNode({ autoTrigger: true }, { disabled: true }), api));
176+
expect(readTrigger()).toEqual({ spinning: true, disabled: true });
177+
await act(async () => {
178+
settle();
179+
});
180+
await waitFor(() => expect(readTrigger().spinning).toBe(false));
181+
expect(readTrigger()).toEqual({ spinning: false, disabled: true });
182+
expect(api).toHaveBeenCalledTimes(1);
183+
});
184+
185+
it('an idle menu with no gate is pressable on both channels, and a false node gate does not disable it', () => {
186+
const { api } = pendingHandler();
187+
const read = (channel: Channel, node: Record<string, unknown>) => {
188+
mount(channel, menuNode({}, node), api);
189+
const verdict = readTrigger().disabled;
190+
cleanup();
191+
return verdict;
192+
};
193+
expect({
194+
direct: read('direct', {}),
195+
node: read('node', {}),
196+
nodeFalseGate: read('node', { disabled: 'features.unlocked == true' }),
197+
}).toEqual({ direct: false, node: false, nodeFalseGate: false });
198+
});
199+
});
200+
201+
describe('action:group — a host-disabled group disables what the user can press (objectui#11182)', () => {
202+
const GROUP_ACTIONS = [
203+
{ name: 'approve', label: 'Approve', type: 'api' },
204+
{ name: 'reject', label: 'Reject', type: 'api' },
205+
];
206+
207+
function mountGroup(node: Record<string, unknown>) {
208+
const { api } = pendingHandler();
209+
return render(
210+
<ActionProvider handlers={{ api }}>
211+
<PredicateScopeProvider scope={SCOPE}>
212+
<SchemaRenderer schema={{ type: 'action:group', actions: GROUP_ACTIONS, ...node } as never} />
213+
</PredicateScopeProvider>
214+
</ActionProvider>,
215+
);
216+
}
217+
218+
const inlineMembers = () => ['Approve', 'Reject'].map(
219+
(name) => (screen.getByRole('button', { name }) as HTMLButtonElement).disabled,
220+
);
221+
222+
it('inline mode: every member button is disabled, and the wrapper carries no `disabled` attribute', () => {
223+
const { container } = mountGroup({ display: 'inline', disabled: true });
224+
expect(inlineMembers()).toEqual([true, true]);
225+
const wrapper = container.querySelector('[data-obj-type="action:group"]');
226+
expect(wrapper).not.toBeNull();
227+
expect(wrapper).not.toHaveAttribute('disabled');
228+
});
229+
230+
it('dropdown mode: the trigger is disabled', () => {
231+
mountGroup({ display: 'dropdown', label: 'Decide', disabled: true });
232+
expect((screen.getByRole('button', { name: 'Decide' }) as HTMLButtonElement).disabled).toBe(true);
233+
});
234+
235+
it('no gate, or a false one, leaves both modes pressable', () => {
236+
for (const gate of [{}, { disabled: 'features.unlocked == true' }]) {
237+
mountGroup({ display: 'inline', ...gate });
238+
expect(inlineMembers()).toEqual([false, false]);
239+
cleanup();
240+
mountGroup({ display: 'dropdown', label: 'Decide', ...gate });
241+
expect((screen.getByRole('button', { name: 'Decide' }) as HTMLButtonElement).disabled).toBe(false);
242+
cleanup();
243+
}
244+
});
245+
});

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

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ const InlineActionButton: React.FC<{
7373
onExecute: (action: UIActionSchema) => Promise<void>;
7474
/** The row the group is mounted over — see `DropdownActionItem` (objectui#4075). */
7575
record?: unknown;
76-
}> = ({ action, variant, size, onExecute, record }) => {
76+
/**
77+
* The GROUP's host-evaluated enablement verdict, which the group takes by
78+
* name and hands to every member it draws (objectui#11182). A group-level
79+
* `disabled` has no control of its own to land on in inline mode — the
80+
* wrapper is a `div` — so the members are what it disables.
81+
*/
82+
hostDisabled?: boolean;
83+
}> = ({ action, variant, size, onExecute, record, hostDisabled }) => {
7784
const [loading, setLoading] = useState(false);
7885
// The row bound the three canonical ways — `record.status`, bare `status`,
7986
// `data.status`. This leaf used to evaluate against nothing at all, so a
@@ -120,7 +127,11 @@ const InlineActionButton: React.FC<{
120127
// `enabled` leg is negated and therefore behaviour-preserving under the
121128
// same definition — derivation in
122129
// `__tests__/action-disabled-declared-gate.test.tsx`.
123-
disabled={(
130+
//
131+
// `hostDisabled` leads the OR (objectui#9131, applied to the group by
132+
// objectui#11182): the group's host verdict is a reason to disable,
133+
// never a reason to enable. See `action:button`.
134+
disabled={hostDisabled || (
124135
hasDeclaredVisibilityGate((action as any).disabled)
125136
? isDisabledPred
126137
: hasDeclaredVisibilityGate(action.enabled)
@@ -212,9 +223,11 @@ DropdownActionItem.displayName = 'DropdownActionItem';
212223

213224
// Index signature on the parameter annotation, not on the `forwardRef` type
214225
// argument — see the mechanism note on `action:bar` (objectui#4422), pinned by
215-
// `__tests__/forwardref-props-annotation.guard.test.ts`.
226+
// `__tests__/forwardref-props-annotation.guard.test.ts`. `disabled` is the
227+
// host-EVALUATED enablement verdict, declared rather than left to the index
228+
// signature, as `ActionButtonRendererProps` declares it (objectui#9131).
216229
const ActionGroupRenderer = forwardRef<HTMLDivElement, { schema: ActionGroupSchema; className?: string }>(
217-
({ schema, className, ...props }: { schema: ActionGroupSchema; className?: string; [key: string]: any }, ref) => {
230+
({ schema, className, ...props }: { schema: ActionGroupSchema; className?: string; disabled?: boolean; [key: string]: any }, ref) => {
218231
const {
219232
'data-obj-id': dataObjId,
220233
'data-obj-type': dataObjType,
@@ -224,6 +237,14 @@ const ActionGroupRenderer = forwardRef<HTMLDivElement, { schema: ActionGroupSche
224237
// (objectui#4075). Also keeps `data` out of `...rest`, which is spread
225238
// onto the DOM wrapper in inline mode.
226239
data,
240+
// The host's EVALUATED verdict, taken by name — the objectui#9131 rule
241+
// `action:button` and `action:icon` follow (objectui#11182).
242+
// `SchemaRenderer` forwards `disabled: __disabled || undefined` with the
243+
// key unconditional. Left on `rest`, inline mode spread it onto the
244+
// wrapping `div`, where a `disabled` attribute disables nothing, and
245+
// dropdown mode dropped it: a host-disabled group left every member
246+
// (inline) or its trigger (dropdown) pressable. Both modes consume it.
247+
disabled: hostDisabled,
227248
...rest
228249
} = props;
229250

@@ -357,7 +378,8 @@ const ActionGroupRenderer = forwardRef<HTMLDivElement, { schema: ActionGroupSche
357378
variant={(schema.variant || 'outline') as any}
358379
size={(schema.size === 'md' ? 'default' : (schema.size || 'default')) as any}
359380
className={cn(schema.className, className)}
360-
disabled={dropdownLoading}
381+
// `hostDisabled` leads the OR (objectui#9131) — see `action:button`.
382+
disabled={hostDisabled || dropdownLoading}
361383
{...{ 'data-obj-id': dataObjId, 'data-obj-type': dataObjType, style }}
362384
>
363385
{dropdownLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
@@ -399,6 +421,7 @@ const ActionGroupRenderer = forwardRef<HTMLDivElement, { schema: ActionGroupSche
399421
size={schema.size}
400422
onExecute={handleExecute}
401423
record={data}
424+
hostDisabled={hostDisabled}
402425
/>
403426
))}
404427
</div>

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,11 @@ ActionAutoTrigger.displayName = 'ActionAutoTrigger';
194194

195195
// Index signature on the parameter annotation, not on the `forwardRef` type
196196
// argument — see the mechanism note on `action:bar` (objectui#4422), pinned by
197-
// `__tests__/forwardref-props-annotation.guard.test.ts`.
197+
// `__tests__/forwardref-props-annotation.guard.test.ts`. `disabled` is the
198+
// host-EVALUATED enablement verdict, declared rather than left to the index
199+
// signature, as `ActionButtonRendererProps` declares it (objectui#9131).
198200
const ActionMenuRenderer = forwardRef<HTMLButtonElement, { schema: ActionMenuSchema; className?: string }>(
199-
({ schema, className, ...props }: { schema: ActionMenuSchema; className?: string; [key: string]: any }, ref) => {
201+
({ schema, className, ...props }: { schema: ActionMenuSchema; className?: string; disabled?: boolean; [key: string]: any }, ref) => {
200202
const {
201203
'data-obj-id': dataObjId,
202204
'data-obj-type': dataObjType,
@@ -206,6 +208,15 @@ const ActionMenuRenderer = forwardRef<HTMLButtonElement, { schema: ActionMenuSch
206208
// Also keeps `data` out of `...rest`, which is spread onto the DOM
207209
// trigger button.
208210
data,
211+
// The host's EVALUATED verdict, taken by name — the objectui#9131 rule
212+
// `action:button` and `action:icon` follow (objectui#11182).
213+
// `SchemaRenderer` forwards `disabled: __disabled || undefined` with the
214+
// key unconditional, and `...rest` is spread after the trigger's own
215+
// `disabled`, so a PRESENT `undefined` re-declared it: through
216+
// `SchemaRenderer` an in-flight menu's trigger read `disabled=false`
217+
// while its spinner showed, and a second execution could start. Taking
218+
// it off `rest` removes that second writer; the trigger consumes it.
219+
disabled: hostDisabled,
209220
...rest
210221
} = props;
211222

@@ -366,7 +377,12 @@ const ActionMenuRenderer = forwardRef<HTMLButtonElement, { schema: ActionMenuSch
366377
schema.className,
367378
className,
368379
)}
369-
disabled={loading}
380+
// `hostDisabled` leads the OR (objectui#9131): the host verdict is
381+
// a reason to disable, never a reason to enable — `SchemaRenderer`
382+
// emits `true` or `undefined`, never `false`. The menu declares no
383+
// enablement gate of its own, so the only other source is an
384+
// execution in flight. See `action:button`.
385+
disabled={hostDisabled || loading}
370386
aria-label={schema.label || moreActionsLabel}
371387
{...rest}
372388
{...{ 'data-obj-id': dataObjId, 'data-obj-type': dataObjType, style }}

0 commit comments

Comments
 (0)