Skip to content

Commit 91cec45

Browse files
committed
test(plugin-list): pin that the sort picker leaves out a field the object marks hidden
Claude-Session: https://claude.ai/code/session_01Utp6CY1ikAq74XRbNdsyUC Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1c53783 commit 91cec45

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/plugin-list': patch
3+
---
4+
5+
fix(plugin-list): the list's sort picker no longer offers a field the object marks hidden, such as the queue column or the search index
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
**Visible behaviour change on a released page.** A list's 排序 / Sort picker offered every field of the object, including the injected system columns the platform marks `hidden: true` (the queue column, the `__search` companion shown as an untranslated "Search Index", `organization_id`). The Filter panel's field list already left those out; the sort picker now follows the same rule.
11+
12+
- A field the object definition marks `hidden: true` is no longer listed in the sort picker, and "Add sort" never starts on one.
13+
- A view or saved sort that already orders by such a field keeps working: the field stays listed in that row as removable only (disabled), as the picker already does for an unreadable or refused field, so the row is not blank and can be removed.
14+
- A hidden lookup (such as `organization_id`) no longer raises the "relational fields cannot be sorted" hint under the rows, since the picker never offered it.

‎ui/packages/plugin-list/src/__tests__/ListView.sortFieldRead-11943.test.tsx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,19 @@ describe('the Sort picker field list asks the column read check (objectui#11943)
222222
expect(screen.getByTestId('sort-relational-info')).toBeInTheDocument();
223223
});
224224
});
225+
226+
describe('a lookup the definition marks hidden does not raise the relational hint (objectstack#30037)', () => {
227+
it('withheld like an unreadable lookup: not offered and no hint; a visible lookup still raises it', async () => {
228+
// `organization_id` is the platform's hidden lookup: the picker never
229+
// offers it, so the hint has nothing to explain.
230+
const hiddenLookup = { ...FIELDS, org: { type: 'lookup', label: 'Organization', reference: 'sys_org', hidden: true } };
231+
mount({ perms: FULL_READ, fields: hiddenLookup });
232+
expect(await openSortOptions()).toEqual(FULL_READ_LABELS);
233+
expect(screen.queryByTestId('sort-relational-info')).toBeNull();
234+
cleanup();
235+
const visibleLookup = { ...FIELDS, org: { type: 'lookup', label: 'Organization', reference: 'sys_org' } };
236+
mount({ perms: FULL_READ, fields: visibleLookup });
237+
await openSortOptions();
238+
expect(screen.getByTestId('sort-relational-info')).toBeInTheDocument();
239+
});
240+
});

‎ui/packages/plugin-list/src/__tests__/ListView.sortRemovableOnly-11943.test.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
* - UNREADABLE: field-level read denies it (`canReadField`, objectui#11943).
1919
* - PLATFORM-REFUSED: the served projection refuses to order by it (#6455).
2020
* - RELATIONAL: a lookup, listed as ordering by ID (objectui#4243).
21+
* - HIDDEN: the object definition marks it `hidden: true` (objectstack#30037),
22+
* the rule the Filter panel's list already follows. `search_index` stands
23+
* in for the platform's `__search` companion and its `queue` column.
2124
*
2225
* In each case the field is declared FIRST on the object, so an "Add sort" that
2326
* still seeded the first entry would seed it. The controls: a field the picker
@@ -44,6 +47,7 @@ const FIELD_DEFS: Record<string, Record<string, unknown>> = {
4447
owner: { type: 'lookup', label: 'Owner', reference: 'sys_user' },
4548
title: { type: 'text', label: 'Title' },
4649
priority: { type: 'number', label: 'Priority' },
50+
search_index: { type: 'text', label: 'Search Index', hidden: true },
4751
};
4852

4953
/** The object definition with `first` declared first, the rest in `FIELD_DEFS` order. */
@@ -74,7 +78,7 @@ function attachProjection(def: ReturnType<typeof definition>) {
7478
const resolved = resolveObjectSortability(def) as { fields: Record<string, unknown> };
7579
const fields: Record<string, unknown> = { ...resolved.fields };
7680
// The base the refusal is measured against: every other field is sortable.
77-
for (const name of ['secret_note', 'owner', 'title', 'priority']) {
81+
for (const name of ['secret_note', 'owner', 'title', 'priority', 'search_index']) {
7882
expect(fields[name]).toEqual({ sortable: true });
7983
}
8084
fields.remote_status = { sortable: false };
@@ -175,6 +179,7 @@ const CASES = [
175179
{ name: 'unreadable', field: 'secret_note', label: 'Secret Note' },
176180
{ name: 'platform-refused', field: 'remote_status', label: 'Remote Status' },
177181
{ name: 'relational', field: 'owner', label: 'Owner (by ID)' },
182+
{ name: 'hidden', field: 'search_index', label: 'Search Index' },
178183
] as const;
179184

180185
describe('a field the Sort picker keeps only for the current sort is removable only (objectui#11943)', () => {

0 commit comments

Comments
 (0)