Handle several columns of one field in a table view

Merged
FE
2d ago
+527-76

Tables could only hold one column per field. A view can now also hold non-canonical view fields (isCanonical: false, already on main), and lookup columns (#30439) are built on them. This PR makes the table handle them correctly. It adds no way to create one.

Changes

  • Column identity: a column is its view field, not its field. Cells, cell editors and the column header act on that column, so two columns of one field don't share editor state.
  • Canonical column: RecordField.isCanonical (missing means canonical) and one findCanonicalRecordField helper. Hiding, showing and the hidden-fields menus (+ header button, Options → Fields, field search, record table widget settings) only touch a field's own column.
  • Delete column: an extra column's header menu and its Options → Fields row offer Delete instead of Hide. The delete is optimistic, and only that column comes back if it fails. The hook checks the view permission itself (like Hide's save), so neither entry point deletes on a view the user can't change.
  • Other layouts: extra columns are table-only. Kanban, calendar and list views leave them out, and so does duplicating a view into one of those types. Switching a view back to a table re-syncs its fields from the latest view, so they come back without a reload.

Stack

Lookup columns show one field of the record a many-to-one relation points to (Company › Address on People); aggregate columns show a count or sum over a one-to-many relation (People › Count on Companies). Each PR targets the one it builds on; retarget it to main once that one merges.

Size counts changed lines outside tests and generated files: S < 300, M 300–800, L > 800.

PRWhat it doesSizeCodeTests / generatedBuilds on
#30472Server: a view field can show one field of its related record (relationTargetFieldMetadataId)M+401 −39+552 −3merged into main
#30450Server: lookup columns in the view field AI toolsS+32+152main
#30348 👈Front: tables handle several columns of one fieldS+289 −70+193main
#30439Front: lookup columns, added from the + menuL+1012 −229+395 −30#30348
#30482Server + front: aggregate columns (count, sum, avg, min, max)L+1200 −268+1725 −122#30439

Independent of this stack: #30347 (nested one-to-many filter / orderBy / first) and #30485 (upsertViewWidget keeps omitted filter group fields and clears them on null), both on main.

Testing

  • Unit: findCanonicalRecordField, isCanonicalRecordField, isRecordFieldSupportedByViewType, useDeleteRecordTableColumn (including no delete without view permission), plus the record-table, record-field and views suites.
  • Browser check on People (dev seed): a lookup column's header menu shows Move and Delete column, without Hide; deleting it persists after reload.
  • Browser check: People with four lookup columns, Options → Layout → Calendar, then Table: all four columns are back without a reload.
  • Front typecheck and oxlint.

Screenshots

An extra column's header menu: Delete column instead of Hide.

Extra column header menu


Generated by Claude Code