refactor(views): ListView reads spec-canonical columns, legacy fields folded in one normalizer (#2890) - #2932
Merged
Merged
Conversation
…lds` folded in one normalizer (#2890) `ListViewSchema` has been spec-derived since #2231, but the renderer still spoke objectui's own vocabulary. First rename closed: `fields` → `columns`. Legacy acceptance stays (stored view metadata carries `fields`) but moves into a single documented normalizer instead of per-read-site fallbacks: - `normalizeListViewSchema` (@object-ui/core) folds `fields` into `columns` (canonical wins) and drops the legacy key so a missed read-site fails loudly. It also absorbs the `viewType` renderability default ListView applied inline. Non-mutating, idempotent, returns its input by reference when nothing folds. - `ListView` normalizes once at the component boundary. That call site — not the zod schema — is the guarantee: nothing on the render path parses view metadata through zod, so a `z.preprocess` on `ListViewSchema` would never run. - Producers emit `columns`: ObjectView's `renderListView` payload, ObjectDataPage, InterfaceListPage and the `list-view` registry defaults were downgrading already-canonical `columns` config back to `fields`. Also fixes the filter builder's objectDef-not-loaded fallback, which resolved only `name`/`fieldName` and so produced unnamed entries for ListColumn objects. `fields` stays declared on the schema and in the drift guard's sanctioned set — it is still valid input, and @objectstack/spec's react-blocks.ts sanctions it as the React-tier `<ListView fields>` prop — but it is input-only now. Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the first rename in #2890 scope A:
fields→columns.ListViewSchemahas been derived from@objectstack/spec/uisince #2231, but the renderer still spoke objectui's own vocabulary for the same concepts. This PR moves every ListView read-site onto the spec key and puts legacy acceptance in exactly one place.What changed
normalizeListViewSchema(@object-ui/core) — foldsfieldsintocolumns(canonical wins when both are present) and drops the legacy key, so a read-site that was missed fails loudly instead of quietly taking the legacy path. It also absorbs theviewTyperenderability defaultListViewapplied inline. Non-mutating, idempotent, and returns its input by reference when there is nothing to fold, so ListView's downstreamuseMemos keep a stable dependency identity on the already-canonical path.ListViewnormalizes once at the component boundary, before anything reads the schema.columns—ObjectView'srenderListViewpayload,ObjectDataPage,InterfaceListPageand thelist-viewregistry defaults were downgrading already-columns-keyed view config back tofields.name/fieldName, soListColumnobjects produced unnamed filter entries. It now readsfieldtoo.Why not a
z.preprocessonListViewSchemaThe issue suggests a spec-side preprocess, on the precedent of
normalizeFilterOperator. That mechanism cannot work here: nothing on the render path parses view metadata through zod. The zod schemas serve the CLI validator, the VS Code extension and tests;ListViewSchemaat the render site is a TypeScript type annotation, erased at compile time. A schema-level fold — spec-side or local — would never execute. The guarantee has to come from a call site, so that is where it lives. (Two more findings about the spec-side route are written up on the issue.)Per AGENTS.md Commandment #0.1 this is deliberately not a per-read-site
??dual-read: those had already drifted (ObjectGridpreferredcolumnsin one branch andfieldsin another). Like the spec's own migration bridges, the fold is expected to be dropped in a future major once stored metadata is migrated.fieldsstays declared onListViewSchemaand in the drift guard's sanctioned set — it is still valid input, and@objectstack/spec'sreact-blocks.tssanctions it as the React-tier<ListView fields>prop — but it is input-only now.Verification
normalize-list-view.test.ts— 13 tests (fold, precedence, drop, idempotence, reference stability, non-object input).ListViewconsumer regression — 4 tests asserting the$selectprojection is built fromcolumns, fromListColumnobjects, from legacyfields, and thatcolumnswins when both are present.ListViewsuite (170 tests) authorsfields:throughout and passes unchanged — that is the legacy-acceptance proof.vitest run,turbo run type-checkover the 5 touched packages (32 tasks), and ESLint on every changed file (0 errors).🤖 Generated with Claude Code