@@ -73,6 +73,7 @@ import { resolveRowCrudAffordances, resolveRowRecordCrudAffordance } from './row
7373import { useRecordCrudVerdicts } from './hooks/useRecordCrudVerdicts' ;
7474import { resolveLegacyRowActions } from './resolveLegacyRowActions' ;
7575import { resolveBulkActions , resolvePromotedBulkParams } from './resolveBulkActions' ;
76+ import { useUndeclaredActionNamesWarning } from './undeclaredActionNames' ;
7677import { partitionBulkRows } from './bulkEligibility' ;
7778import { RowActionMenu , formatActionLabel } from './components/RowActionMenu' ;
7879import { BulkActionBar } from './components/BulkActionBar' ;
@@ -997,9 +998,10 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
997998 // Legacy `rowActions` carry a bare action NAME, which the runner cannot
998999 // execute on its own — resolve each against the object's declared actions so
9991000 // it dispatches as a real def (and so a name that duplicates an existing
1000- // `list_item` def stops rendering a dead twin of it). See
1001+ // `list_item` def stops rendering a dead twin of it). A name the object does
1002+ // not declare draws nothing and is reported below, in development. See
10011003 // `resolveLegacyRowActions` for the full rationale (objectui#2960).
1002- const { defs : resolvedRowActionDefs , unresolved : customRowActions } = resolveLegacyRowActions ( {
1004+ const { defs : resolvedRowActionDefs , undeclared : undeclaredRowActions } = resolveLegacyRowActions ( {
10031005 rowActions : rowActionsList . filter ( a => a !== 'edit' && a !== 'delete' ) ,
10041006 rowActionDefs : rowActionDefsList ,
10051007 objectActions : ( objectSchema as any ) ?. actions ,
@@ -1250,14 +1252,16 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
12501252 : declaredBulkActions ?. filter ( ( a : unknown ) => String ( a ) . toLowerCase ( ) !== 'delete' ) ;
12511253 // `bulkActions` carries a bare action NAME, which the runner cannot execute
12521254 // on its own — resolve each against `objectDef.actions` so it dispatches as a
1253- // real def. See `resolveBulkActions` (objectui#3002). The
1255+ // real def. See `resolveBulkActions` (objectui#3002). A name the object does
1256+ // not declare gets no button (spec: a bare name "names an action the object
1257+ // declares") and is reported below, in development. The
12541258 // canonical `'delete'` is held back: it routes to `onBulkDelete` (which owns
12551259 // confirm + refresh), not the runner, even if the object declares an action
12561260 // that happens to be named `delete`.
12571261 const legacyBulkNames = ( explicitBulkActions ?? [ ] ) . filter (
12581262 ( a : unknown ) => String ( a ) . toLowerCase ( ) !== 'delete' ,
12591263 ) ;
1260- const { defs : resolvedBulkDefs , unresolved : unresolvedBulkActions } = resolveBulkActions ( {
1264+ const { defs : resolvedBulkDefs , undeclared : undeclaredBulkActions } = resolveBulkActions ( {
12611265 bulkActions : legacyBulkNames ,
12621266 bulkActionDefs : Array . isArray ( schema . bulkActionDefs ) ? schema . bulkActionDefs : [ ] ,
12631267 objectActions : ( objectSchema as any ) ?. actions ,
@@ -1277,18 +1281,33 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
12771281 ( objectCanDelete || def ?. operation !== 'delete' )
12781282 && ( rowEditVerdict . allowed || def ?. operation !== 'update' ) ,
12791283 ) ;
1280- // Names still dispatched by string: the unresolved ones, plus `'delete'`
1281- // when the author asked for it — or the implicit bulk-delete affordance.
1284+ // The one name still dispatched by string: `'delete'` when the author asked
1285+ // for it — or the implicit bulk-delete affordance. An undeclared name is not
1286+ // among them: it draws nothing.
12821287 const keptDeleteAction = ( explicitBulkActions ?? [ ] ) . filter (
12831288 ( a : unknown ) => String ( a ) . toLowerCase ( ) === 'delete' ,
12841289 ) ;
12851290 const effectiveBulkActions : string [ ] =
12861291 explicitBulkActions && explicitBulkActions . length > 0
1287- ? [ ... unresolvedBulkActions , ... keptDeleteAction ]
1292+ ? keptDeleteAction
12881293 : canDelete && onBulkDelete && bulkActionDefs . length === 0
12891294 ? [ 'delete' ]
12901295 : [ ] ;
12911296 const hasBulkActions = effectiveBulkActions . length > 0 || bulkActionDefs . length > 0 ;
1297+ // The names the two folds above did not draw, said once in development. Only
1298+ // once the object's actions are known: before that every name is undeclared.
1299+ const undeclaredNamesReady = objectSchema != null || ! schema . objectName ;
1300+ const undeclaredNamesAddress = {
1301+ blockType : ( schema as { type ?: unknown } ) . type ,
1302+ objectName : schema . objectName ,
1303+ label : schema . label ?? ( schema as { title ?: unknown } ) . title ,
1304+ } ;
1305+ useUndeclaredActionNamesWarning ( {
1306+ key : 'bulkActions' , names : undeclaredBulkActions , ready : undeclaredNamesReady , address : undeclaredNamesAddress ,
1307+ } ) ;
1308+ useUndeclaredActionNamesWarning ( {
1309+ key : 'rowActions' , names : undeclaredRowActions , ready : undeclaredNamesReady , address : undeclaredNamesAddress ,
1310+ } ) ;
12921311 let selectionMode : 'none' | 'single' | 'multiple' | boolean = false ;
12931312 if ( schema . selection !== undefined ) {
12941313 // "presence enables; an explicit off wins" — the ONE rule both
@@ -1676,7 +1695,7 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
16761695 columnsWithActions, hasActions, hasPinnedColumns, hasUserPinnedColumns, pinnedLeftCols,
16771696 pinnedRightCols, unpinnedCols, rightPinnedClasses, rightPinnedCellClasses, userLeftPinnedCount,
16781697 } = resolveObjectGridActionsColumn ( {
1679- schema, data, objectSchema, persistedColumns, operations, customRowActions , resolvedRowActionDefs,
1698+ schema, data, objectSchema, persistedColumns, operations, resolvedRowActionDefs,
16801699 wantEditAction, wantDeleteAction, mayInvokeRowAction, rowOperations, canEdit, canDelete,
16811700 recordVerdict, predicateScope, onEdit, onDelete, editPredicates, deletePredicates, executeAction,
16821701 setRefreshKey, t,
0 commit comments