Skip to content

Commit 85e56c4

Browse files
docs(mosaic): trim shared action lock guidance
1 parent 8b8df5f commit 85e56c4

1 file changed

Lines changed: 5 additions & 19 deletions

File tree

‎packages/mosaic/docs/controllers.md‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ return {
5151
};
5252
```
5353

54-
When a direct action and a confirmation must share admission, create one
54+
When a direct action and a confirmation must not run together, create one
5555
`useActionLock` (`src/hooks/use-action-lock.ts`) and inject it into both owners:
5656

5757
```ts
@@ -63,24 +63,10 @@ const remove = useConfirmController({
6363
});
6464
```
6565

66-
The lock admits synchronously, so two calls in one event cannot both start.
67-
Its `tryRun` returns `undefined` without invoking busy work, or a promise that
68-
preserves the accepted action's result or rejection. It stays held until the
69-
actual action settles, even if a dialog closes and stops observing the action.
70-
Opening a dialog does not acquire the lock. The lock owns no errors or row IDs.
71-
`usePendingAction` keeps its inline errors and boolean result; refused runs
72-
return `false` without changing metadata. `useConfirmController` keeps removal
73-
errors in its dialog; refusal leaves the dialog and its error unchanged.
74-
Pass the section's pending state to `Confirmation.disabled` to disable its submit
75-
control while another action runs. Admission still runs through the lock. Without an
76-
injected lock, each owner retains its existing independent behavior.
77-
78-
`actionLock` is a hook option, not a per-run option. Project its `isPending` to
79-
the controls in the shared section. For contact primary changes, close the menu
80-
on selection by leaving `ActionMenu.status` undefined, disable Add and keep
81-
Manage disabled but focusable, and show a delayed row spinner beside the value.
82-
Use one `useSpinDelay` outside the row map with `minDuration: 0`, so feedback ends
83-
with the request. The Primary badge replaces the spinner after success.
66+
Pass `actionLock.isPending` to the section controls' `disabled` props, including
67+
`Confirmation.disabled`. The lock prevents overlapping requests even before React
68+
renders the disabled controls, and stays held until the action settles. Each owner
69+
keeps its existing error handling. `actionLock` is a hook option, not a per-run option.
8470

8571
`run` resolves `true` on success, so the caller can close a dialog or move
8672
focus. To hold pending through an OAuth redirect, await a delay inside the

0 commit comments

Comments
 (0)