Repository navigation
fix(plugin-detail): lead the derived related table with the record name - #30090
Merged
Merged
Conversation
With no columns declared for the relation, the related table took its columns from the child's highlightFields, which never list the record's title. Lead that set (and the field walk) with the record's name through core's leadWithNameField, listed once, so the enlarged grid's first, auto-linked column names the record. Claude-Session: https://claude.ai/code/session_01WGufzewdXHDkMAKTyWjGh5 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzewdXHDkMAKTyWjGh5 Co-authored-by: Claude <noreply@anthropic.com>
…-2heymj Claude-Session: https://claude.ai/code/session_01WGufzewdXHDkMAKTyWjGh5 Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#1 · os-support-ai · session_01WGufzjDyeFwq6AuFu3vwTd 维护者速读(席位终稿)
席位核对 · ACCEPT · head
|
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.
Requested by Yibo Wang · project thread
Fixes #30033
Clause-②: no
Metadata-protocol: none
维护者速读
highlightFields,而它按设计从不含记录名称。现在用@object-ui/core现成的leadWithNameField(ADR-0079:nameField,否则平台推导的名称字段)把名称放到第一列,高亮字段跟在后面;高亮里本来就有名称时只出现一次。没有highlightFields时的字段遍历同样让声明的名称领头。RelatedList.tsx的派生列;作者在关系上声明的列原样不动,highlightFields含义、高亮条和概览紧凑面板都没碰。名称列照样过 FLS、脱敏、外键剔除与全空剔除。@object-ui/plugin-detailpatch。回滚 = revert 本 PR。ui/packages/plugin-detail/src/RelatedList.tsx中effectiveColumns的declaredHighlights分支与字段遍历排序后的leadWithNameField三行;测试RelatedList.enlargedListGrid-28865.test.tsx末尾的objectstack#30033describe。pnpm --dir ui exec vitest run packages/plugin-detail/src/__tests__/RelatedList.enlargedListGrid-28865.test.tsx,预期18 passed;或在 example CRM 打开 Acme Corp 的「商机」页签,第一列是「商机名称」且可点开记录。What changes
ui/packages/plugin-detail/src/RelatedList.tsx,effectiveColumns, the two paths taken when the relation declares no columns:highlightFieldspath. The declared highlights now go throughleadWithNameField(objectSchema, declaredHighlights)before the existing normalize, redaction, parent-key, FLS and empty gates. That helper is the one@object-ui/corealready exports for exactly this (a synthesized list led by the record's name; the console's object list tabs andInterfaceListPagecall it): the declarednameField(ADR-0079), else the type-aware derivation, moved to the front and listed once. It adds nothing when the name has no field definition, ishidden, or the derivation lands on a system-managed field. Because it runs before the gates, a name the reader may not read, a redacted one, or one that is the key back to the parent record is still dropped.highlightFields). After the existing priority sort, the declared or derived name is moved to the front only if it is already among the surviving entries, so a field the walk filtered out never comes back. The name-ish ranking stays as the fallback order.columnson the relation) take the first branch, which is untouched: drawn exactly as declared.object-gridthese keys, and the grid auto-links its first column to the record (pinned bythe auto-linked primary field gets the same anchorinplugin-grid'sObjectGrid.linkCellAnchor.test.tsx), so the name is now the row's link. The non-enlarged table (data-table, throughsortableColumns/tableColumns) reads the sameeffectiveColumns, so it gets the same lead. Two more readers ofeffectiveColumns[0]and the key list move with it: the phone card gallery'stitleField(now the name) and the CSV export's field list (now includes the name). The compact panels on 概览 return before any of these and are unchanged.titleFormat.leadWithNameFieldanswers in field space: a legacytitleFormatis a render-only template with no column behind it, so atitleFormat-only object leads with the field the platform derives (pinned below), not the formatted title.Metadata-protocol: none,Clause-②: no: no export, key or accepted value changes. Changeset:@object-ui/plugin-detailpatch.Tests
New top-level
describeinRelatedList.enlargedListGrid-28865.test.tsx(the enlarged face's shared harness), 7 cases:highlightFieldsthat omit the name (['account', 'amount', 'close_date', 'probability'], ascrm_opportunitydeclares): the grid's columns are['name', 'amount', 'close_date', 'probability'](the parent keyaccountis dropped as before).nameFieldthat is not name-ish (deal_title) leads the same way.highlightFieldstoo: shown once, first.data-tablecolumns lead withname.highlightFields: a declared name leads the field walk.titleFormatwith nonameField: the column is the derived field (code), not the formatted title.Runs
Test Files 1 passed (1),Tests 18 passed (18).scripts/ablation-replace.mjsreplacingleadWithNameField(objectSchema, declaredHighlights).map(normalizeColumn)withdeclaredHighlights.map(normalizeColumn)(anchor 1 to 0, blobedff8db6toeed0f11d): 5 failed, 13 passed. Red: the highlight case (expected [ 'amount', 'close_date', …(1) ]), the non-name-ishnameField, the name-once case, the non-enlarged table, thetitleFormatcase. Restored: blob equals HEAD,git diff HEADempty.entries.unshift(...entries.splice(leadAt, 1))line: 1 failed (no highlightFields: a declared name leads the field walk too), 17 passed. Restored the same way.../RelatedListfrom source, so no dist rebuild sits between the mutation and the run.@object-ui/plugin-detailsuite under the lock, before themainmerge:Test Files 369 passed | 1 skipped (370),Tests 3260 passed | 18 skipped (3278).Acceptance notes
Browser check,
examples/app-crmdev boot (pnpm dev:crm -- --fresh), Console fromui/source through vite, zh-CN, dev admin, Acme Corp. Before =RelatedList.tsxatorigin/mainc23501b2b, after = this branch; vite restarted between the legs and the served module checked for the change each time. Headers read off the page:Acme — Year-Ago Renewal→ the opportunity recordAda Lovelace→ the contact recordProduct Demo — Globex New CRM→ the activity recordBefore, the row link text was
75,000.00,ada@acme.exampleand会议. 联系人 resolves through its declarednameField: 'full_name'(a formula); 商机 and 活动 declare none and lead with the derivedname/subject. Screenshots (before-*.png,after-*.png, plus*-readings.json) are in the project'sui-orders/30033-shots/folder.The non-enlarged face. Measured in code: it reads the same
effectiveColumns, so it is fixed in the same place and pinned above. Measured in the browser: on the example CRM's account and opportunity record pages the 概览 tab draws only the compact panels (zero tables on either page), so there is no body table there to photograph.maxColumns. The derived set is still capped atmaxColumns(default 6), and the name now takes one of those slots, so a child with six or more highlights shows one highlight fewer.Verification
All on head
8408edf6(this branch merged withorigin/maind79eecfe5; the merge brought no change underui/packages/plugin-detail/or core'srecord-title.ts), after a fullturbo run buildof the merged tree (119/119), underscripts/pm/os-verify-lock.sh:pnpm --dir ui --filter @object-ui/plugin-detail run type-check(both programs; the test file is intsconfig.test.json's file list): exit 0.npx eslint src/RelatedList.tsx src/__tests__/RelatedList.enlargedListGrid-28865.test.tsxfrom the package: 0 errors.node scripts/check-sdui-manifest.mjs: exit 0, manifest intact (106 components).node scripts/pm/dispatch-gates.mjs --commandsderived 35 gates over the 3 changed paths; all 35 ran, allexit 0;--ranreconciles35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN.@object-ui/plugin-detailvitest suite ran before the merge (above); the merge touched nothing it reads from source. The other families are this PR's CI check-runs.Human Minimum
packages/specchange.@object-ui/plugin-detailpatch, both declaration lines in it and here.packages/specuntouched.Generated by Claude Code