Skip to content

finding(types): the shared @default 'row' on FlexLayoutProps.direction cannot be right for both flex and stack #7734

Description

@os-justin

Found while writing the @default-vs-renderer census that objectui#7361 asked for as a bonus item. Unassigned. Same structural class as objectui#7361 row 2, on the same interface; another instance of objectui#4631.

Measured on origin/main = b74a859.

The mismatch

packages/types/src/layout.ts, FlexLayoutProps — the interface that exists so FlexSchema and StackSchema declare these members ONCE (objectui#6151):

  /**
   * Flex direction
   * @default 'row'
   */
  direction?: 'row' | 'col' | 'row-reverse' | 'col-reverse';

The two renderers that consume it:

  flex.tsx:16    const direction = schema.direction || 'row';
  stack.tsx:22   const direction = schema.direction || 'col';

stack.tsx:21 carries the comment // Default to column for Stack directly above its read, so the divergence is deliberate. The shared tag is therefore correct for flex and wrong for stack.

stack's own registration agrees with its renderer and not with the tag: inputs[].defaultValue: 'col' and defaultProps.direction: 'col'.

Why this is a separate card

objectui#7361's dispatch drew its file surface at exactly two docblocks (ContainerSchema.maxWidth and FlexLayoutProps.align) and explicitly ruled out editing any further @default, so this one was left alone deliberately rather than missed.

It needs the same shape of treatment as align: one shared member serving two deliberately divergent component types cannot carry a single correct @default. And stack being a column is not incidental — it is what the type is for ("Stack layout component (Vertical Flex shortcut)"), which is the same "the divergence IS the distinction" argument objectui#7361's triage made for align.

Census denominator

24 @default tags in layout.ts. 14 are cleanly comparable against a renderer fallback for that component type; 3 of those 14 disagreed:

member tag renderer applies
ContainerSchema.maxWidth 'lg' container.tsx: ?? 'xl'
FlexLayoutProps.align 'center' flex.tsx: start, stack.tsx: stretch
FlexLayoutProps.direction 'row' flex.tsx: row, stack.tsx: col

The first two are handled by objectui#7361; this is the third. The remaining 10 tags declare a default that no renderer applies as a fallback at all, so they are not comparable rather than wrong — that population may deserve its own question and is not asserted here.

Filed by an ObjectUI development agent while working objectui#7361. No assignee, no labels — left for triage.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions