fix(list): keep injected owner_id out of auto-generated list columns (#2777)#2779
Merged
Conversation
…2777) ObjectView renders an object's default "所有记录" list (and prefills the "Add View" dialog) from field order when the object declares no explicit list view. Both paths carried their own name-based SYSTEM_FIELDS set that — like the pre-#2702 lists in ObjectGrid / InterfaceListPage — never listed owner_id. Since applySystemFields spreads injected system/audit/ownership fields to the FRONT of the field map and owner_id is deliberately non-hidden / non-readonly (ownership is reassignable), it leaked through as the leading raw-id column on every view-less object (e.g. showcase_invoice), redundant with the business owner (Field.user) column. Derive both paths through a single shared defaultListColumnsFromObject helper that classifies system fields via isSystemManagedField from @object-ui/types (the classifier #2702 introduced) — branching on the spec `system` flag with a name-set fallback covering the ownership/tenancy FKs. Auto-derived lists lead with business fields again and pick up future injected fields without editing a name list. Adds a red/green unit test + changeset. Closes #2777. Co-Authored-By: Claude Opus 4.8 <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.
Problem
On a view-less object's auto-generated default list view (the "所有记录" tab), the framework-injected
owner_idrenders as a leading, raw-id column — same value on every row, redundant with the businessowner(Field.user) column. Repro: showcase Invoices (showcase_invoicedeclares no.view.ts).This is the exact anti-pattern #2702 set out to remove, but #2702 only covered two of the three default-column derivation sites:
plugin-grid/ObjectGrid.tsxapp-shell/InterfaceListPage.tsx(defaultColumnsFromObject)app-shell/ObjectView.tsx(resolveDefaultColumns+ "Add View" prefill)ObjectViewcarried its own name-basedSYSTEM_FIELDSset that never listedowner_id. SinceapplySystemFieldsspreads injected fields to the FRONT of the field map andowner_idis deliberately non-hidden / non-readonly (ownership is reassignable), it leaked through as column #1.Fix
Derive both
ObjectViewpaths through a single shared, exporteddefaultListColumnsFromObject(objectDef, limit)helper that classifies system fields viaisSystemManagedFieldfrom@object-ui/types(the classifier #2702 introduced) — branching on the specsystemflag with a name-set fallback that covers the ownership / tenancy FKs. Removes the two duplicated hardcoded lists; auto-derived lists lead with business fields again and pick up future injected fields without editing a name list.Test / verification
ObjectView.defaultColumns.test.tsxreproduces theshowcase_invoiceshape: reverting the classifier putsowner_idfirst (fails); the fix leads withinvoice_no(passes). 5 tests green.@object-ui/app-shellfull build (tsc, 29-pkg graph) passes — no type regressions.Closes #2777.
🤖 Generated with Claude Code