Skip to content

Commit a5a5312

Browse files
feat(console): keep list column widths, row height and tab order in this browser only (#36133)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuVWbxPZ72M6BDYup19WL5XS)_ Part of #35955 ## What changes On a Console object list, the column widths, the row height and the order of the view tabs are now kept in the reader's browser only. The Console no longer reads or writes the per-user list preference row `sys_user_preference` `ui.list.<object>`. - New `ui/packages/app-shell/src/views/listLayoutStore.ts`: one localStorage entry per signed-in reader and object, `list-layout:<user id>:<object>`, holding `viewOrder` and per view `widths` / `rowHeight` and nothing else. With nobody signed in there is no key: nothing is read or written. Built on `useSyncExternalStore`, so every reader of the same object sees a write at once. - The keys an earlier Console wrote list state under (`list-state:*`, the cache of the retired server row; `list-filters:*`; the bare `viewOrder:*`) are removed once per page load and never read. What they held is not carried over. - `ListPreferencesProvider` is deleted; `ConsoleShell` no longer creates or attaches the `ui.list.` family, and `UserStateAdapters` drops its list-state slot. The boot read of the reader's preferences now asks for the four keys and the `ui.record.` prefix only. - The list no longer waits for a preference read before it mounts (the `object-view-list-preferences-pending` placeholder is gone). - `listFilterStorage.ts` is deleted: `writeListFilterState` had no caller (F4 of the card). - The relay-shape types the list draft uses (`ListViewPreference` and friends) move into `listDraftStore.ts`. - `RecordPreferencesProvider` (`ui.record.*`) is untouched. - Docs: `content/docs/ui/views.mdx` says the layout stays in this browser. The platform checklist items `records-forms.adhoc-filter-sort-builder` (rev 14) and `records-forms.grid-personalization` (rev 10) are re-pointed; the latter now reads that widths and row height do not follow the reader to a fresh browser (Sales ruling D1 on #35955). - Comment and README fixes in `@object-ui/data-objectstack`, `@object-ui/react` and `@objectstack/platform-objects` that named the retired key. Not in this pull request: - `os migrate list-preferences`, the operator command that deletes the stored `ui.list.*` rows (dry run by default, `--apply` only with an owner-only `--export`). This PR was over 3,000 changed lines with it, so it follows in its own pull request once this one merges. Until then the rows stay, unread. - Keeping `list-layout:` entries across a sign-out by the same person: follow-up #36110. Sign-out still clears them, as today. - Related-tab column widths (`ui.record.<object>.relatedLists`): #35892. - The spec `columnState` retirement. ## Why Card #35955 (epic #35547): a list change is a draft, and what never becomes a draft (widths, row height, tab order) is arranging only, so it stays in the reader's browser and never reaches another user, device or browser. ## Verification - The 13 changed or rewritten test files pass: 177 tests (`pnpm --dir ui exec vitest run …`). They include `listLayoutStore.slot-35955.test.tsx` (sanitize, patch, localStorage-only writes with no request, cross-instance sync, entry removal, no entry while signed out, retired-key sweep), `ObjectView.userListState-12418.test.tsx` (40 cases on the real page, writes recorded at the storage door), `signOutPurge.test.tsx` and `consoleUserPreferenceBudget.test.tsx` (one read, no `ui.list.` prefix, no `ui.list.*` write). - `@object-ui/app-shell` type-check (`tsc --noEmit` and `tsc -p tsconfig.test.json`) passes. - ESLint on the changed files: 0 errors. - `node scripts/check-platform-checklist.mjs`: OK. - The full `@object-ui/app-shell` suite runs in CI (Test UI). Tests rewritten because the provider they drove is gone: - `ListPreferencesProvider.slot-12418.test.ts` → `views/listLayoutStore.slot-35955.test.tsx`. - `ObjectView.userListState-12418`: the provider and family harness is replaced by a seeded localStorage entry. "Waits for the read" cases are gone. The 500 ms debounce case is replaced by "re-stating a width just written sends no second write". The provider-less CONTROL block now pins the retired-key sweep. - `ObjectView.personalViews-29635` (#30034): the default view's state is a held draft, so the second read is gone. The "reverse order" case becomes "the personal views read landing at once". - `signOutPurge`: the server-save-before-sign-out case is gone, since there is no server save. The sign-out sweep cases now cover `list-layout:*`. - `consoleUserPreferenceBudget`, `ObjectView.listPersonalized-28950`, `ObjectView.listUrlState-11860`, `ObjectView.ufViewSwitch-11992`, `ObjectView.emptyColumnsNoProjection-10694`, `objectViewViewCrud.draftBarChange-35932` and `ObjectView.overlayPatchOnly`: the harness or source pin is updated. Overlap: merges cleanly with `main`. It textually overlaps #36123 (PR2 of the same card) and #36128. Whichever of PR2 and this one lands later merges `main`. Clause-②: no Metadata-protocol: none ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (Not touched.) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUkr3W7rNEqPk3J858 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 48c732c commit a5a5312

35 files changed

Lines changed: 1126 additions & 1826 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/data-objectstack': patch
4+
'@object-ui/react': patch
5+
'@objectstack/platform-objects': patch
6+
---
7+
8+
feat(console): a list's column widths, row height and tab order are kept in this browser only
9+
10+
Clause-②: no
11+
Metadata-protocol: none
12+
13+
On a Console object list, the column widths a reader drags, the row height they pick and the order they give the view tabs are now kept in their own browser only, per signed-in user and object (localStorage `list-layout:<user id>:<object>`). Nothing is sent to the server: the Console no longer reads or writes the per-user list preference row `sys_user_preference` `ui.list.<object>`, and its boot read of the reader's preferences no longer asks for that key family. A list opens at once, without waiting for that read.
14+
15+
- Another browser or device opens the list on its view's own widths, row height and tab order until the reader changes them there.
16+
- Signing out clears these entries with the rest of this browser's Console state, as before.
17+
- With nobody signed in, nothing is kept.
18+
- The record page's "show empty fields" choice (`ui.record.<object>`) is unchanged and still follows the reader.
19+
20+
Upgrade note: what an earlier Console kept for a reader's lists is not carried over. The `ui.list.<object>` rows are no longer read, so every reader's lists open on their views' own widths, row height and tab order until they change them again. This browser's old copies (`list-state:*`, `list-filters:*` and `viewOrder:*` in localStorage) are removed on the first list the Console opens. The server rows stay where they are, unread; leaving them does no harm.
21+
22+
`@object-ui/data-objectstack`, `@object-ui/react` and `@objectstack/platform-objects` change only comments and a README example that named the retired key. No metadata key, value or default changes.

‎content/docs/ui/views.mdx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,11 @@ also holds Discard on a narrow list or a phone).
653653
- The draft survives opening a record and coming back. Opening another view or object,
654654
or reloading the list's page, drops it, so that reload opens the view as it is declared.
655655
- Column widths, the row height (density) and the views' order are not a draft: they are
656-
remembered for the user (`sys_user_preference`, key `ui.list.<object>`). A sort, filter,
657-
column order or hidden column an earlier Console stored there no longer applies.
656+
remembered in this browser only, per signed-in user and object (localStorage
657+
`list-layout:<user id>:<object>`). Nothing is sent to the server, another browser or device
658+
opens the view's own layout, and signing out clears them with the rest of this browser's
659+
Console state. Earlier Consoles kept them, with a stored sort and filters, in the user's
660+
`sys_user_preference` row `ui.list.<object>`; nothing reads that row now.
658661
- A link carrying list state (`uf_*` parameters) applies it as a draft, whether it opens in a
659662
new tab or in-app (an AI answer's list link, after a reload of the chat page too).
660663
- When a session ends, the sign-in page's return link keeps the list's path but never its

‎docs/qa/platform-checklist/areas/records-forms.json‎

Lines changed: 24 additions & 12 deletions
Large diffs are not rendered by default.

‎packages/platform-objects/src/pages/sys-user.page.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ export const SysUserDetailPage: Page = {
750750
},
751751
// ── Preferences ───────────────────────────────────────────
752752
// [#23803] This user's `sys_user_preference` rows — the console's
753-
// per-user UI state (`ui.recent`, `ui.favorites`, `ui.list.<object>`
753+
// per-user UI state (`ui.recent`, `ui.favorites`, `ui.record.<object>`
754754
// …). Setup's "User Preferences" menu entry, which listed every
755755
// user's rows, left the menu; this tab is where an administrator
756756
// reaches them now, from the user they belong to.

‎ui/packages/app-shell/src/console/ConsoleShell.tsx‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,9 @@ import { FlowPaletteRecentsProvider } from '../context/FlowPaletteRecentsProvide
4141
import { LastAppProvider, LAST_APP_PREFERENCE_KEY } from '../context/LastAppProvider.js';
4242
import {
4343
UserStateAdaptersProvider,
44-
useAttachListStateFamily,
4544
useAttachRecordStateFamily,
4645
useAttachUserStateAdapters,
4746
} from '../context/UserStateAdapters.js';
48-
import {
49-
LIST_PREFERENCE_PREFIX,
50-
ListPreferencesProvider,
51-
} from '../context/ListPreferencesProvider.js';
5247
import {
5348
RECORD_PREFERENCE_PREFIX,
5449
RecordPreferencesProvider,
@@ -203,7 +198,6 @@ function ConsoleShellProviders({ children }: { children: ReactNode }) {
203198
<RecentItemsProvider>
204199
<FlowPaletteRecentsProvider>
205200
<LastAppProvider>
206-
<ListPreferencesProvider>
207201
<RecordPreferencesProvider>
208202
{/* objectstack#36112 — inside an app from 768 px up the three
209203
are drawn at the top of the content area instead
@@ -241,7 +235,6 @@ function ConsoleShellProviders({ children }: { children: ReactNode }) {
241235
<NotificationSnackbar />
242236
<NotificationAlerts />
243237
</RecordPreferencesProvider>
244-
</ListPreferencesProvider>
245238
</LastAppProvider>
246239
</FlowPaletteRecentsProvider>
247240
</RecentItemsProvider>
@@ -388,7 +381,6 @@ function UserStateBridge() {
388381
const { user } = useAuth();
389382
const dataSource = useAdapter();
390383
const attach = useAttachUserStateAdapters();
391-
const attachListState = useAttachListStateFamily();
392384
const attachRecordState = useAttachRecordStateFamily();
393385

394386
useEffect(() => {
@@ -397,7 +389,6 @@ function UserStateBridge() {
397389
attach('recent', null);
398390
attach('flowPaletteRecents', null);
399391
attach('lastApp', null);
400-
attachListState(null);
401392
attachRecordState(null);
402393
return;
403394
}
@@ -422,35 +413,27 @@ function UserStateBridge() {
422413
userId: user.id,
423414
key: LAST_APP_PREFERENCE_KEY,
424415
});
425-
// objectui#12418 — every object's list state, `ui.list.<object>`: a key
426-
// family, loaded by prefix in the same one read as the three slots above.
427-
const listState = createObjectStackUserPreferenceFamily({
428-
dataSource,
429-
userId: user.id,
430-
prefix: LIST_PREFERENCE_PREFIX,
431-
});
432416
attach('favorites', favorites);
433417
attach('recent', recent);
434418
attach('flowPaletteRecents', flowPaletteRecents);
435419
attach('lastApp', lastApp);
436420
// objectstack#25883 — every object's record-page state, `ui.record.<object>`
437-
// ("show empty fields"): a second key family in the same one read.
421+
// ("show empty fields"): a key family loaded by prefix in the same one
422+
// read as the slots above.
438423
const recordState = createObjectStackUserPreferenceFamily({
439424
dataSource,
440425
userId: user.id,
441426
prefix: RECORD_PREFERENCE_PREFIX,
442427
});
443-
attachListState(listState);
444428
attachRecordState(recordState);
445429
return () => {
446430
attach('favorites', null);
447431
attach('recent', null);
448432
attach('flowPaletteRecents', null);
449433
attach('lastApp', null);
450-
attachListState(null);
451434
attachRecordState(null);
452435
};
453-
}, [user?.id, dataSource, attach, attachListState, attachRecordState]);
436+
}, [user?.id, dataSource, attach, attachRecordState]);
454437

455438
return null;
456439
}

‎ui/packages/app-shell/src/console/__tests__/consoleListStateWall-12418.test.tsx‎

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
* `walledCatalogWriteVerdict`). A header sort and a Manage Views drag used to
77
* be such writes: the sort PUT the view, the drag PATCHed a `sortOrder` onto
88
* every saved view, so a workspace admin who is not the operator got an error
9-
* for a personal preference. They are the user's own list state now, a
10-
* `sys_user_preference` row: an organization row the tenant's user may write
11-
* under every posture.
9+
* for a personal preference. They are the user's own list state now. Since
10+
* objectstack#35955 the sort is the list's draft and the tab order and the
11+
* density are the reader's layout in this browser
12+
* (`list-layout:<user id>:<object>`, `../../views/listLayoutStore.ts`), so
13+
* neither reaches the server at all: no metadata write, and no
14+
* `sys_user_preference` write either.
1215
*
1316
* ## The tree
1417
*
1518
* The real `ConsoleShell` providers, the real `ConnectedShell` (its real
16-
* `ObjectStackAdapter`, its `UserStateBridge` and the list-state family), and
19+
* `ObjectStackAdapter` and its `UserStateBridge`), and
1720
* the real object page inside it, over the fake framework the preference
1821
* budget pin uses (`preferenceFramework.ts`), here WALLED: every metadata
1922
* write is answered 403. The session reports the `group` posture and a
@@ -23,13 +26,12 @@
2326
*
2427
* ## The pins
2528
*
26-
* 1. A header sort and a drag-reorder put NO metadata write on the wire
27-
* and raise no error. The drag lands as ONE preference write of the
28-
* object's row; the sort is the list's draft (objectstack#35955) and
29-
* writes nothing.
29+
* 1. A header sort and a drag-reorder put NO write on the wire and raise no
30+
* error. The drag is kept in this browser's layout entry; the sort is
31+
* the list's draft and is kept nowhere.
3032
* 2. objectui#12474 — the density toggle and a Hide Fields change put NO
31-
* metadata write on the wire and raise no error. The density lands as
32-
* ONE preference write of the same row; the hide is the draft's.
33+
* write on the wire and raise no error. The density is kept in the same
34+
* layout entry; the hide is the draft's.
3335
* 3. CONTROL — the wall is live: a metadata write made in this same tree
3436
* (the real adapter's own view write, `createView`) is answered 403.
3537
* Since objectui#12474 no list toolbar control makes one, so the control
@@ -126,7 +128,8 @@ import { useAdapter } from '../../providers/AdapterProvider';
126128
import '@objectstack/lint';
127129
import { ObjectView } from '../../views/ObjectView';
128130
import { resetListDraftStoreForTests } from '../../views/listDraftStore';
129-
import { createPreferenceFramework, preferenceRowId, type PreferenceFramework } from './preferenceFramework';
131+
import { listLayoutStorageKey, resetListLayoutStoreForTests } from '../../views/listLayoutStore';
132+
import { createPreferenceFramework, type PreferenceFramework } from './preferenceFramework';
130133

131134
const FIELDS = {
132135
id: { type: 'text', label: 'Id' },
@@ -142,7 +145,7 @@ const OBJECT = {
142145
},
143146
};
144147

145-
/** The user already has a list-state row for the object (from another device). */
148+
/** A list-state row an earlier Console stored for the user: no longer read or written (objectstack#35955). */
146149
const STORE = { u1: { 'ui.list.account': { viewOrder: [ALL_ID, MINE_ID] } } };
147150

148151
let fake: PreferenceFramework;
@@ -174,10 +177,14 @@ function boot() {
174177
);
175178
}
176179

180+
/** The reader's layout entry for the object in this browser. */
181+
const storedLayout = () => JSON.parse(localStorage.getItem(listLayoutStorageKey('u1', OBJECT_NAME)!) ?? 'null');
182+
177183
const wait = (ms: number) => act(() => new Promise<void>((resolve) => setTimeout(resolve, ms)));
178184

179185
beforeEach(() => {
180186
resetListDraftStoreForTests();
187+
resetListLayoutStoreForTests();
181188
listProps = null;
182189
pageAdapter = null;
183190
localStorage.clear();
@@ -195,7 +202,7 @@ afterEach(() => {
195202
});
196203

197204
describe('a user\'s list state under a walled posture (objectui#12418)', () => {
198-
it('a header sort and a drag-reorder write no metadata and raise no error; the drag lands as one preference write, the sort as the draft', async () => {
205+
it('a header sort and a drag-reorder write nothing to the server and raise no error; the drag is kept in this browser, the sort as the draft', async () => {
199206
boot();
200207
await waitFor(() => expect(typeof listProps?.onSortChange).toBe('function'), { timeout: 5000 });
201208
await screen.findByTestId('stub-reorder');
@@ -208,22 +215,18 @@ describe('a user\'s list state under a walled posture (objectui#12418)', () => {
208215
await act(async () => {
209216
fireEvent.click(screen.getByTestId('stub-reorder'));
210217
});
211-
// Past the preference debounce (500 ms) and the round trip.
212-
await waitFor(() => expect(fake.wire.writes).toHaveLength(1), { timeout: 3000 });
213-
await wait(400);
218+
// Past the old preference debounce (500 ms) and a round trip.
219+
await wait(900);
214220

215221
expect(fake.wire.metaWrites).toEqual([]);
222+
expect(fake.wire.writes).toEqual([]);
216223
expect(toast.error).not.toHaveBeenCalled();
217-
expect(fake.wire.writes).toHaveLength(1);
218-
const [write] = fake.wire.writes;
219-
// An update of the row the boot read found: no second read, no insert.
220-
expect(write.id).toBe(preferenceRowId('u1', 'ui.list.account'));
221224
expect(fake.wire.gets.length).toBe(readsBefore);
222-
// objectstack#35955 — the sort is the list's draft: it is stored nowhere.
223-
expect(write.value).toEqual({ viewOrder: [MINE_ID, ALL_ID] });
225+
// objectstack#35955 — the order is this browser's; the sort is the list's draft, stored nowhere.
226+
expect(storedLayout()).toEqual({ viewOrder: [MINE_ID, ALL_ID] });
224227
});
225228

226-
it('a density toggle and a Hide Fields change write no metadata and raise no error; the density lands as one preference write, the hide as the draft (objectui#12474)', async () => {
229+
it('a density toggle and a Hide Fields change write nothing to the server and raise no error; the density is kept in this browser, the hide as the draft (objectui#12474)', async () => {
227230
boot();
228231
await waitFor(() => expect(typeof listProps?.schema?.onDensityChange).toBe('function'), { timeout: 5000 });
229232
await wait(100);
@@ -232,30 +235,21 @@ describe('a user\'s list state under a walled posture (objectui#12418)', () => {
232235
act(() => {
233236
listProps.schema.onDensityChange('comfortable');
234237
});
235-
// Past the preference debounce (500 ms) and the round trip.
236-
await waitFor(() => expect(fake.wire.writes).toHaveLength(1), { timeout: 3000 });
237-
await wait(400);
238-
expect(fake.wire.metaWrites).toEqual([]);
239-
expect(toast.error).not.toHaveBeenCalled();
240-
expect(fake.wire.writes).toHaveLength(1);
241-
expect(fake.wire.writes[0].id).toBe(preferenceRowId('u1', 'ui.list.account'));
242-
expect(fake.wire.writes[0].value).toEqual({
243-
viewOrder: [ALL_ID, MINE_ID],
244-
perView: { [ALL_ID]: { rowHeight: 'medium' } },
245-
});
238+
await wait(100);
239+
expect(storedLayout()).toEqual({ perView: { [ALL_ID]: { rowHeight: 'medium' } } });
246240
// The list is handed the user's density back.
247241
expect(listProps.schema.rowHeight).toBe('medium');
248242

249243
act(() => {
250244
listProps.onHiddenFieldsChange(['name']);
251245
});
252-
// Past the preference debounce (500 ms) and a round trip: nothing more is written.
246+
// Past the old preference debounce (500 ms) and a round trip: nothing is written.
253247
await wait(900);
254248
expect(fake.wire.metaWrites).toEqual([]);
249+
expect(fake.wire.writes).toEqual([]);
255250
expect(toast.error).not.toHaveBeenCalled();
256-
expect(fake.wire.writes).toHaveLength(1);
257251
expect(listProps.schema.hiddenFields).toEqual(['name']);
258-
// No second read: each write updates the row the boot read found.
252+
expect(storedLayout()).toEqual({ perView: { [ALL_ID]: { rowHeight: 'medium' } } });
259253
expect(fake.wire.gets.length).toBe(readsBefore);
260254
});
261255

0 commit comments

Comments
 (0)