Skip to content

completeListViewColumnOrder

completeListViewColumnOrder<TFieldSlug>(props): ColumnEntry<TFieldSlug>[]

Defined in: packages/core/src/collections/listView/listViewColumnOrder.ts:60

Completes a (possibly partial, possibly back-compat bare-slug) stored column-entry array into a full array covering every one of collection’s own data fields, exactly once, in display order (Decision 48), PLUS the synthetic version-status column (VERSION_SYSTEM_FIELDS.status.slug, "vex_status") on a versioned collection (collection.versions.drafts) — developer-reported: resizing/pinning/hiding/reordering it used to silently no-op (CollectionListView’s buildStatusColumn() rendered it OUTSIDE this entry-driven model entirely, hardcoded always-first/always- visible/never-pinnable), since there was no ColumnEntry for a resize commit or a pin toggle to write to. It now participates FULLY, like any real field — reorderable, hideable, pinnable, resizable, saved in views/the URL cols=, prerendered, counted by Reset/Modified — with ONE deliberate difference from a real field’s own back-fill default: an entry order already names keeps its own position AND its own width/ pinned/hidden/enableSorting/enableHiding overrides untouched, same as any field; a REAL field order does NOT name is APPENDED, in the collection’s own field-declaration order, as an explicitly hidden bare-shape entry ({ field, hidden: true }) — this is what lets an OLD, pre-Decision-48 stored view (which only ever listed its VISIBLE fields, Decision 11’s original shape, still true of every Step-20-saved cols=/view after its own Round-3 fix) resolve correctly under the unified model: a field it never named becomes an explicit hidden: true entry instead of silently missing from the table’s column set/drag- reorder menu/columns menu row list. vex_status instead defaults to VISIBLE (a bare { field }, no hidden override) when order doesn’t name it — EVERY stored view predates this column’s own participation in ColumnEntry/cols= at all (it could never have been named, visible or hidden, before this change existed), so treating its absence the same as a real field’s (silently hidden) would make the status column vanish from every existing saved view the instant this ships, not a neutral “field never interacted with” default, and is UNSHIFTED to the very FRONT of the whole result (not merely sorted first within the back-filled tail, which would still land it after every already-named real field) — preserving today’s “status column shows first” default for every existing view, none of which can have named it yet.

Also drops any entry naming a field that no longer exists on collection (renamed/removed since the view was saved) and deduplicates a repeated field entry, keeping its FIRST occurrence — defensive, since a stale/duplicate entry would otherwise either crash or double-render a column.

TFieldSlug extends string = string

Input props.

CollectionConfig

Resolves the full field-declaration order (and versions.drafts, which decides whether vex_status is a known field at all).

ColumnEntry<TFieldSlug>[] | undefined

The stored/URL column-entry array, or undefined for “nothing stored” (every REAL field appended hidden, vex_status — on a versioned collection — appended visible; see this function’s own doc comment for why the two defaults differ).

ColumnEntry<TFieldSlug>[]

Every one of collection’s own data field keys, exactly once, each a ColumnEntry, in the resolved display order — plus vex_status (versioned collections only).