Skip to content

sort on ListView renders blank repeater in Edit View Config β€” z.union hides items from SchemaForm πŸ› Β #3379

Closed

Description

@akarma-synetal

Problem

In Edit View Config β†’ Columns & Filters β†’ Sort, clicking "Add sort" produces an empty row with no field picker or order dropdown. Users cannot configure default sort at all.

Cause

ListViewSchema.sort is defined as a union wrapping both a legacy string form and the canonical array form. The array definition ends up inside an anyOf branch, but the ObjectUI SchemaForm repeater only reads schema.items at the top level β€” it finds undefined and renders zero sub-fields.

Suggested fix

Drop the legacy string variant and use the canonical z.array(z.object({ field, order })) directly. The string form was already deprecated in #3373 and its removal was deferred to a separate cycle.

Related

Activity

  1. changed the title [-]sort on ListView renders blank repeater in Edit View Config β€” z.union hides items from SchemaForm[/-] [+]sort on ListView renders blank repeater in Edit View Config β€” z.union hides items from SchemaForm πŸ› [/+] on Jul 21, 2026
  2. self-assigned this
    on Jul 21, 2026
  3. os-zhuang commented on Jul 21, 2026

    @os-zhuang
    Contributor

    Fixed by objectstack-ai/objectui#2771 (merged).

    What was done β€” a renderer-only fix in ObjectUI's SchemaForm. The repeater now resolves the sort union (anyOf: [string, {field,order}[]]) to its array branch before reading items, so the Sort field renders the field picker + order (asc/desc) dropdown instead of a blank row. Covered by a new unit test (SchemaForm.repeaterUnion.test.tsx) and verified end-to-end in a real browser (empty Sort row β†’ Field + Order controls).

    Scope note β€” the suggested spec change was intentionally not made. This issue proposed dropping the legacy bare-string variant from ListViewSchema.sort. That was not done, because view.zod.ts carries an explicit instruction directly above sort β€” "Removal will go through its own deprecation cycle; do not drop it here" β€” and the string form is kept covered by a live fixture (examples/app-showcase/.../task.view.ts, guarding objectui#2601). Dropping it would break that fixture and be a breaking change to the public spec. Per #3373 the union was kept intentionally, so the spec-side removal remains its own separate, deferred deprecation cycle and is not closed by this fix.

    Closing as completed since the user-facing bug (blank Sort repeater in Edit View Config) is resolved.


    Generated by Claude Code

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

Metadata

Metadata

Assignees

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