Skip to content

DataTableSchema.rowActions is z.array in the zod mirror and boolean everywhere else — the mirror is the outlier #6940

Description

@os-sam

Filed unassigned by the os-dev seat while implementing #6318. Grading and domain:* are the triage seat's.

Measured

packages/types/src/zod/data-display.zod.ts:249

rowActions: z.array(z.any()).optional().describe('Row action buttons'),

Every other face of the same key says boolean:

  • packages/types/src/data-display.ts:850rowActions?: boolean; (the TS declaration this const mirrors)
  • packages/components/src/renderers/complex/data-table.tsx:718 — destructured as rowActions = false
  • same file, 2046 / 2467 — used as a truthiness gate around the actions cell
  • same file, 2069 / 2511 — used as + (rowActions ? 1 : 0) in a colSpan
  • same file, 2669 — the registered input is { name: 'rowActions', type: 'boolean', label: 'Show Row Actions', defaultValue: false }
  • same file, 2682 — defaultProps: { rowActions: true }
  • same file, 677 — the renderer's own docblock example authors "rowActions": true

So the mirror is the single outlier, and it is the published one: safeValidateSchema refuses rowActions: true, which is the spelling the component's own documentation, defaults and authoring inputs all teach.

Cost, today

Two examples/schema-catalog entries fail safeValidateSchema for this and no other reason — components-complex-data-table/user-table.json and .../full-featured-table.json. Both are reported by objectui check as content carrying a registered type that does not validate.

Why the array spelling is not merely "also accepted"

#6318's triage test applied to it, rendering through the real SchemaRenderer:

authored elements text
rowActions: true (as the fixtures have it) 42 User Actions John Doe
rowActions: [] (the smallest zod-valid value) 42 User Actions John Doe
key absent 39 User John Doe

An empty array renders the actions column, because [] is truthy. "Correcting" the fixtures to satisfy the mirror would therefore change nothing on screen while making the documents say something the renderer cannot act on — the fixtures are right and the mirror is wrong.

Suggested repair

Mirror the declaration: rowActions: z.boolean().optional(). This is a widening for no author (nothing can be reading a value the renderer only tests for truthiness) and it takes the two catalog entries out of the bucket. packages/types/src/__tests__/data-table-declared-keys-6882.test.ts is the natural place to pin it.

⚠️ Note packages/types/src/zod/objectql.zod.ts:143 declares a different rowActionsz.array(z.string()), the list view's legacy bare-name action list (packages/types/src/objectql.ts:857). That one is correct as it stands and is not part of this finding; the two keys share a name and nothing else.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatfindingpm:dispatchedpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions