Skip to content

Commit b78016f

Browse files
huangyiireneclaude
andauthored
docs(showcase): correct RecalcSelectionAction TSDoc to the post-objectui#3142 placement rule (#7420) (#7540)
The TSDoc above RecalcSelectionAction narrated the pre-objectui#3142 rule as current fact: that a missing/empty `locations` is treated as "every location" by the action:bar renderer, so declaring `record_more` was an opt-out that kept the action off the list toolbar. objectui#3142 inverted that. It collapsed four disagreeing renderers onto one membership predicate (`actionRendersAt`), so an undeclared or empty `locations` now matches NO location. `packages/lint/src/validate-action-locations.ts`'s docblock states the current rule, and the whole `action-no-placement` warning exists because of it -- the lint package and this comment said opposite things about the same behavior. The declaration itself is correct either way and is unchanged: `record_more` is an explicit single-record placement (the endpoint's per-record branch, via `recordIdParam`), which incidentally also keeps the action off the toolbar -- not an opt-out of an everywhere-default. Comment lines only; the code is byte-identical after stripping comments. Claude-Session: https://claude.ai/code/session_01GZKbx4xyF7U5WXj6ch49BM Co-authored-by: Claude <noreply@anthropic.com>
1 parent b03b0e1 commit b78016f

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

  • examples/app-showcase/src/ui/actions

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

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,25 @@ export const RecalcEstimateAction = defineAction({
138138
* shape, minus the zip). Contrast with RecalcEstimateAction above: same
139139
* endpoint, one POST per record.
140140
*
141-
* `locations` still has to be declared, even though the selection bar entry
142-
* comes from the view. Omitting it does NOT mean "nowhere": the action:bar
143-
* renderer treats a missing/empty `locations` as "every location"
144-
* (objectui `action-bar.tsx`), so a locations-less action also lands on the
145-
* LIST TOOLBAR — where there is no selection, so the dispatch posts no
146-
* `_selectedIds` and the endpoint rejects it. Declaring `record_more` keeps
147-
* the single-record entry somewhere it works (the endpoint's per-record
148-
* branch, via `recordIdParam`) and off the toolbar. See objectui#3142.
141+
* `locations` is a SEPARATE declaration from that selection-bar entry, which
142+
* the view owns. It is not redundant, and it is not an opt-out of anything:
143+
* since objectui#3142 an action renders at a location only if it DECLARES
144+
* that location. That release collapsed four disagreeing renderers onto one
145+
* membership predicate (`actionRendersAt`, objectui
146+
* `packages/types/src/ui-action.ts`), so a missing or EMPTY `locations`
147+
* matches NO location at all — an action nobody placed has no UI surface,
148+
* which is precisely the inert shape this repo's `action-no-placement` rule
149+
* warns about (`packages/lint/src/validate-action-locations.ts`), and `[]` is
150+
* that same nowhere said deliberately (see NewTaskAction).
151+
*
152+
* So `record_more` here is an explicit SINGLE-RECORD placement, not a way of
153+
* dodging an everywhere-default: it puts the action in the record overflow
154+
* menu, where the dispatch carries exactly one id and the recalc endpoint's
155+
* per-record branch handles it (via `recordIdParam`). Placement being
156+
* declared rather than inherited is also what keeps the action off the LIST
157+
* TOOLBAR — a toolbar dispatch would carry neither a selection (no
158+
* `_selectedIds`) nor a record id, and the endpoint would reject it — but
159+
* that is a consequence of naming one location, not the reason for naming it.
149160
*/
150161
export const RecalcSelectionAction = defineAction({
151162
name: 'showcase_recalc_selection',

0 commit comments

Comments
 (0)