Skip to content

Commit eb53d63

Browse files
fix(studio): the key-fields editor no longer previews a record-page strip (#36020)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuVwX4pUdM1qvNLSqRZNSvv3)_ repo:objectstack#1 · os-sales · session_01L6bhgW85kwjGaz7HqsmEuv Fixes #35978 Clause-②: no — measured: `@object-ui/i18n` built before (base catalogue, key present) and after (key removed); all 73 emitted `.d.ts` files under `dist/` are byte-identical (`diff -r` exit 0). The studio catalogues are declared `Record<string, string>`, so no key is part of a typed literal or union on any published entry; the key lived only in the emitted `namespaces/studio/en.js` / `zh.js` values. Metadata-protocol: none Skills-docs: none — no skill text names the Studio key-fields editor's preview or the removed catalogue key; what `highlightFields` drives on the record page is the record-page rule follow-up #35942 already carries. ## 维护者速读 - 在 Studio 编辑对象的「重点字段」时,列表下方不再画那条「要点条预览」;字段的上下顺序照旧可拖动和调整。 - 属于「记录详情页重做」专题:详情页已经不画关键字段条,设计器里的预览因此是误导,这里把它拿掉。 - 出错时只影响设计器里这一块的显示,不改存储的元数据;改动可直接撤回。 - 无。 ## What changes - `HighlightFieldsEditor` (app-shell, Studio object settings): the "Highlight strip preview" block (`highlight-preview` / `highlight-preview-cell`) is removed. The ordered row list stays — order still decides which fields each surface takes. The file header and the `HIGHLIGHT_FIELDS_MAX` comment now say what `highlightFields` drives, quoting the spec describe #35977 landed ("Ordered most-important fields; first entry wins where only one fits. Drives default list and related-list columns, cards, hover cards, previews and the record picker; the default record page draws no strip from it."). - `ObjectSettingsPanel.tsx` header comment: "an ordered list with a strip preview" becomes "an ordered list", and "title/stepper/columns" becomes "title/stage/columns" (the default page draws no stepper). The `engine.studio.settings.highlightFields` help text #35977 rewrote still reads right and is untouched; `RelatedListsEditor.tsx` has no strip wording and is untouched. - `engine.studio.settings.highlightPreview` leaves the studio namespace (`en.ts`, `zh.ts` — the namespace's only two catalogues). Repo-wide grep for the key and both test ids: no reader left outside historical CHANGELOG entries. - Changeset: patch for `@object-ui/app-shell`, `@object-ui/console` (app-shell is private and ships inside the Console, as earlier app-shell changesets declare) and `@object-ui/i18n`. ## Tests - `ObjectSettingsPanel.highlightOrder-27054.test.tsx`: the order is pinned on the ROW order (`highlight-row-*`) instead of the preview; the first case asserts the editor is drawn and the preview absent (`highlight-preview` null, zero `highlight-preview-cell`); the move case reads the rows after the move; the remove case asserts no rows left. ## Acceptance notes - The `examples/app-showcase/e2e/detail-shapes.spec.ts` rider moved to #36007 by claim amendment; this PR leaves that file as on `main` (a WIP edit was reverted in its own commit). - Overlap: #35923 edits the adjacent lines of the studio `en.ts` / `zh.ts` (the related-list keys right after the removed line), so a textual conflict arises whichever lands second; resolution is mechanical — drop the `highlightPreview` line and keep #35923's lines. #36012 shares the same files and merges cleanly. ## Verification <details><summary>Local runs (head c3bf8d3)</summary> - `pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectSettingsPanel.highlightOrder-27054.test.tsx` — Test Files 1 passed (1), Tests 6 passed (6). - `pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/` — Test Files 352 passed (352), Tests 2739 passed (2739). - `pnpm --dir ui exec vitest run packages/i18n/` — Test Files 105 passed (105), Tests 1957 passed, 13 skipped. - `pnpm --filter @object-ui/i18n --filter @object-ui/app-shell run type-check` — both Done, lock VERDICT command-exit 0. - Ablation (one-shot, fix committed first): `git checkout ec24363 -- HighlightFieldsEditor.tsx` restored the preview (`data-testid="highlight-preview"` count 1 on disk); the file went red on exactly the new assertion — "shows the stored order in the rows, and draws no strip preview": `expected <div …(2)>…(3)</div> to be null`, Tests 1 failed, 5 passed. Restored with `git checkout HEAD --`; `git diff HEAD` empty and the blob hash equals `HEAD:` (92b4e34). - Clause-② measurement: see the `Clause-②:` line above. - `dispatch-gates --ran`: 38 derived families accounted for — 37 run (exit 0), 1 NOT MEASURED: `pnpm check:type-check-debt` exit 3 (PREREQUISITE NOT MET, needs a full build) — CI's run is the verdict. - `node scripts/pm/overlap-check.mjs --branch=HEAD`: origin/main merges cleanly; #36012 merges cleanly; #35923 conflicts in studio `en.ts` / `zh.ts` (see Acceptance notes). </details> Read first: `HighlightFieldsEditor.tsx` (the removed block and header), then the test file. Two-minute check: run the single test file above; expect 6 passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgW85kwjGaz7HqsmEuv --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent be91bfc commit eb53d63

6 files changed

Lines changed: 43 additions & 37 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/console': patch
4+
'@object-ui/i18n': patch
5+
---
6+
7+
fix(studio): the key-fields editor no longer previews a record-page strip
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
The default record page draws no key-field strip, so Studio's object settings
13+
stop drawing a "Highlight strip preview" under the `highlightFields` list. The
14+
ordered rows stay: order still decides which fields each surface takes. The
15+
`engine.studio.settings.highlightPreview` catalogue key leaves the studio
16+
namespace (English and Chinese).

‎ui/packages/app-shell/src/views/studio-design/HighlightFieldsEditor.tsx‎

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@
99
/**
1010
* The object's `highlightFields` (ADR-0085) as an ORDERED pick list.
1111
*
12-
* Order is the whole meaning of the key: the spec says "first entry wins where
13-
* only one fits", and the record page's highlight strip draws the fields in
14-
* this order. So the editor is a list, not a chip cloud:
12+
* Order is the whole meaning of the key. The spec: "Ordered most-important
13+
* fields; first entry wins where only one fits. Drives default list and
14+
* related-list columns, cards, hover cards, previews and the record picker;
15+
* the default record page draws no strip from it." Each of those surfaces
16+
* takes the fields in this order, as many as it has room for. So the editor
17+
* is a list, not a chip cloud:
1518
*
1619
* - each row can be dragged to a new place, or moved with the up / down
1720
* buttons (the keyboard path; the drag has no keyboard equivalent) — the
1821
* rows are the shared `OrderedRowList`, which `RelatedListsEditor` uses too;
1922
* - fields are added at the end, from the object's visible fields not already
20-
* picked, up to {@link HIGHLIGHT_FIELDS_MAX};
21-
* - a preview below draws the strip in the picked order, so the order is seen
22-
* as the record page will show it.
23+
* picked, up to {@link HIGHLIGHT_FIELDS_MAX}.
24+
*
25+
* The row order is the one rendering of the list here: no surface preview is
26+
* drawn, since no single surface shows the list the way every other does.
2327
*
2428
* Removing the last field removes the key: an empty list and an absent key
2529
* would both read "not declared" here, and only the absent key says it.
@@ -32,8 +36,9 @@ import { OrderedRowList } from './OrderedRowList.js';
3236
import { t, tFormat, type SupportedLocale } from '../metadata-admin/i18n.js';
3337

3438
/**
35-
* How many highlight fields the editor offers. The record-page strip shows a
36-
* handful of facts at a glance; six is the ruled ceiling for authoring here.
39+
* How many highlight fields the editor offers. The surfaces that read the key
40+
* show a handful of facts at a glance, each taking as many as fit; six is the
41+
* ruled ceiling for authoring here.
3742
* A stored list that is already longer is shown whole and never truncated.
3843
*/
3944
export const HIGHLIGHT_FIELDS_MAX = 6;
@@ -53,7 +58,7 @@ export function HighlightFieldsEditor({
5358
}: {
5459
/** The stored list, in order. */
5560
value: string[];
56-
/** The object's fields (labels for the rows and the preview). */
61+
/** The object's fields (labels for the rows). */
5762
fields: readonly FieldEntry[];
5863
/** The next list; `undefined` removes the key. */
5964
onChange: (next: string[] | undefined) => void;
@@ -93,22 +98,6 @@ export function HighlightFieldsEditor({
9398
<span className="text-[11px] text-muted-foreground">{t('engine.studio.settings.undeclared', locale)}</span>
9499
)}
95100
</div>
96-
{value.length > 0 && (
97-
<div className="space-y-1">
98-
<span className="block text-[10px] text-muted-foreground">{t('engine.studio.settings.highlightPreview', locale)}</span>
99-
<div
100-
data-testid="highlight-preview"
101-
className="flex gap-5 overflow-x-auto rounded-md border bg-muted/20 px-3 py-2"
102-
>
103-
{value.map((name) => (
104-
<div key={name} className="min-w-0 shrink-0" data-testid="highlight-preview-cell">
105-
<div className="text-[10px] text-muted-foreground">{labelOf(fields, name)}</div>
106-
<div className="text-[13px] text-muted-foreground/70">—</div>
107-
</div>
108-
))}
109-
</div>
110-
</div>
111-
)}
112101
</div>
113102
);
114103
}

‎ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.highlightOrder-27054.test.tsx‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
* one fits"), and the object settings panel authors it as one.
1212
*
1313
* The real panel, inside a host that feeds every patch back into the draft:
14-
* - the stored order is the row order and the strip preview's order;
14+
* - the stored order is the row order, and no strip preview is drawn: the
15+
* default record page draws no strip from the key, so the rows are the one
16+
* rendering of the list;
1517
* - up / down and a drag move a field, and the written list keeps every other
1618
* field in place;
1719
* - a picked field is appended at the end;
@@ -59,15 +61,16 @@ function Host({ initial, writes }: { initial: Row; writes: Row[] }) {
5961

6062
const rowOrder = () =>
6163
screen.getAllByTestId(/^highlight-row-/).map((el) => el.getAttribute('data-testid')!.replace('highlight-row-', ''));
62-
const previewOrder = () =>
63-
within(screen.getByTestId('highlight-preview')).getAllByTestId('highlight-preview-cell').map((c) => c.firstChild!.textContent);
6464
const lastHighlights = (writes: Row[]) => writes.at(-1)!.highlightFields;
6565

66-
describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a strip preview', () => {
67-
it('shows the stored order in the rows and in the strip preview', () => {
66+
describe('ObjectSettingsPanel — highlightFields is an ordered pick list', () => {
67+
it('shows the stored order in the rows, and draws no strip preview', () => {
6868
render(<Host initial={{ fields: FIELDS, highlightFields: ['status', 'amount', 'name'] }} writes={[]} />);
6969
expect(rowOrder()).toEqual(['status', 'amount', 'name']);
70-
expect(previewOrder()).toEqual(['Status', 'Amount', 'Name']);
70+
// The editor itself is drawn (the control), with no preview beside its rows.
71+
expect(screen.getByTestId('highlight-fields-editor')).toBeInTheDocument();
72+
expect(screen.queryByTestId('highlight-preview')).toBeNull();
73+
expect(screen.queryAllByTestId('highlight-preview-cell')).toHaveLength(0);
7174
});
7275

7376
it('moves a field with the up / down buttons, keeping every other field in place', () => {
@@ -76,7 +79,7 @@ describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a
7679
const amountRow = screen.getByTestId('highlight-row-amount');
7780
fireEvent.click(within(amountRow).getByRole('button', { name: 'Move up' }));
7881
expect(lastHighlights(writes)).toEqual(['amount', 'status', 'name']);
79-
expect(previewOrder()).toEqual(['Amount', 'Status', 'Name']);
82+
expect(rowOrder()).toEqual(['amount', 'status', 'name']);
8083
fireEvent.click(within(screen.getByTestId('highlight-row-amount')).getByRole('button', { name: 'Move down' }));
8184
expect(lastHighlights(writes)).toEqual(['status', 'amount', 'name']);
8285
});
@@ -130,7 +133,7 @@ describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a
130133
render(<Host initial={{ fields: FIELDS, highlightFields: ['status'] }} writes={writes} />);
131134
fireEvent.click(screen.getByRole('button', { name: 'Remove status' }));
132135
expect(writes.at(-1)!.highlightFields).toBeUndefined();
133-
expect(screen.queryByTestId('highlight-preview')).toBeNull();
136+
expect(screen.queryAllByTestId(/^highlight-row-/)).toHaveLength(0);
134137
expect(screen.getByText(t('engine.studio.settings.undeclared', 'en-US'))).toBeInTheDocument();
135138
});
136139
});

‎ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
* first (`7a90afdf9`).
2828
* 3. Semantic roles (ADR-0085) — the cross-surface presentation roles:
2929
* `nameField`, `stageField` (string | false | unset), `highlightFields`
30-
* (an ordered list with a strip preview — `HighlightFieldsEditor`), and
30+
* (an ordered list — `HighlightFieldsEditor`), and
3131
* `relatedLists` (objectstack#27069), the business order of the record
3232
* page's related lists, over the object's inbound relationships
3333
* (`RelatedListsEditor`).
3434
* These are the ONLY presentation knobs the protocol carries, so the
3535
* builder must make them directly editable — otherwise designers fall
36-
* back to guessing which heuristic picked their title/stepper/columns.
36+
* back to guessing which heuristic picked their title/stage/columns.
3737
* 4. Capabilities (framework#2707/#2727) — the `enable.*` record-surface
3838
* switches. Only LIVE flags are exposed (every toggle is enforced at
3939
* runtime — writer gates, 403s, or UI surfaces): trackHistory & files

‎ui/packages/i18n/src/namespaces/studio/en.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,6 @@ const STUDIO_EN: Record<string, string> = {
23502350
'engine.studio.settings.addFieldOption': '+ Add field…',
23512351
'engine.studio.settings.undeclared': '(not declared — surfaces pick heuristically)',
23522352
'engine.studio.settings.highlightMax': 'Up to {max} highlight fields — remove one to add another.',
2353-
'engine.studio.settings.highlightPreview': 'Highlight strip preview',
23542353
'engine.studio.settings.relatedLists': 'Related list order (relatedLists) — the order of the lists of child records on this object\'s record page, most important first; it orders only, and showing or hiding a list stays on its relationship field',
23552354
'engine.studio.settings.relatedListsAdd': '+ Add relationship…',
23562355
'engine.studio.settings.relatedListsTail': 'Not listed — shown after these, in the default order',

‎ui/packages/i18n/src/namespaces/studio/zh.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,6 @@ const STUDIO_ZH: Record<string, string> = {
21362136
'engine.studio.settings.addFieldOption': '+ 添加字段…',
21372137
'engine.studio.settings.undeclared': '(未声明 —— 各处按启发式自动挑选)',
21382138
'engine.studio.settings.highlightMax': '最多 {max} 个重点字段——移除一个才能再添加。',
2139-
'engine.studio.settings.highlightPreview': '要点条预览',
21402139
'engine.studio.settings.relatedLists': '关联列表顺序(relatedLists)—— 本对象记录页上各子记录列表的顺序,最重要的在前;只管排序,显示与否仍在关系字段上设置',
21412140
'engine.studio.settings.relatedListsAdd': '+ 添加关系…',
21422141
'engine.studio.settings.relatedListsTail': '未列出 —— 排在以上之后,按默认顺序',

0 commit comments

Comments
 (0)