Skip to content

View createBuildBody hardcodes viewKind list — form views cannot be created through the create UI #2323

Description

@akarma-synetal

Summary

The ViewItemSchema is a discriminated union on viewKind with both list and form variants, but the create form can only produce list views. Form-family views are unreachable through the create UI.

Root cause — two problems in packages/app-shell/src/views/metadata-admin/anchors.ts:

Problem 1 (line 202): createFields: ['label', 'name', 'object', 'kind'] — no viewKind field. The kind field is a ListViewSchema.type value (grid/kanban/gallery/calendar/timeline/gantt/chart), not a family discriminator.

Problem 2 (lines 234-250): createBuildBody hardcodes viewKind: 'list' at line 242 and writes the kind draft value directly to config.type. There is no code path that produces a viewKind: 'form' ViewItem with a FormViewSchema config.

The spec (spec/src/ui/view.zod.ts, line 1111) defines a discriminated union on viewKind where form items carry FormViewSchema config with type enum ['simple','tabbed','wizard','split','drawer','modal'] (lines 815-822).

Steps to reproduce

  1. Navigate to Metadata → View → Create new
  2. There is no option to choose "List" vs "Form" as the view family
  3. All views created through the form are viewKind: 'list'

Expected behavior

The create form should let users choose "List" or "Form" family, then offer the appropriate layout type per family (grid/kanban/... for list, simple/tabbed/... for form).

Fix

Add viewKind (enum: ['list','form']) and formType (enum from FormViewSchema.type) to createFields and createSchema. Update createBuildBody to discriminate on viewKind.

Impact

Users cannot create form-family views at all through the UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions