Skip to content

Commit 880816c

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-ahwb54-wt
2 parents dc5cf70 + a5a5312 commit 880816c

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)