Skip to content

Commit 9080504

Browse files
committed
test(plugin-list): pin viewDefaults.filters personalization; changeset (#30073)
Claude-Session: https://claude.ai/code/session_01QSeKYpFBMr917PmVkG9up7 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 499ed50 commit 9080504

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/plugin-list': patch
4+
---
5+
6+
feat(app-shell,plugin-list): a personal view's own conditions are Filter panel rows, and 保存 writes the panel back into that view
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- **Opening one of the reader's own views (My views) shows its conditions as ordinary rows in the Filter panel**, with the active count on the Filter control. They are the list's filter while they are there: not applied under the list a second time, and not a personalization. A stored filter the panel cannot hold (an any-of group beside other conditions), or one naming a field the object no longer declares or the reader cannot read, stays applied under the list, as for any other view.
12+
- **Editing those rows marks the list 已个性化, and the marker offers 保存 to that view** (for a reader allowed to update their views). 保存 replaces the row's `config` through the data API with the body Save as my view builds, so the stored `ListView` shape is unchanged and no key is added; the reader's temporary list state for the view is then cleared and the list opens on the saved view. Edits not saved stay the reader's temporary list state and are never written to the view. A panel the fold cannot write losslessly keeps the refusal Save as my view gives, and nothing is written.
13+
- **Save as my view now clears the view it came from**: that view's stored list state (sort, filters, column layout, density, hidden fields) and cached search term go, and the address being left loses its `uf_*` params, so the source no longer reads filtered or 已个性化 after the save.
14+
- Both saves read the Filter panel as the list reports it, not the address's copy, so an emptied panel saves as no filter.
15+
- `@object-ui/plugin-list`: `ListView`'s host prop `viewDefaults` accepts `filters`, the view's own conditions for a host that shows them as panel rows; the `filters` personalization part is then judged against them.

‎ui/packages/plugin-list/src/__tests__/ListView.personalization-28950.test.tsx‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,30 @@ describe('with the callback wired, the host owns the one reset (objectstack#2895
212212
expect(screen.getByTestId('sort-reset-default')).toBeEnabled();
213213
});
214214
});
215+
216+
/**
217+
* objectstack#30073 — a host that shows the view's own conditions as Filter
218+
* panel rows hands them in `viewDefaults.filters`: the panel holding exactly
219+
* those rows is the view's own, and a changed or emptied panel is `filters`.
220+
*/
221+
describe('the view\'s own conditions as panel rows (`viewDefaults.filters`, objectstack#30073)', () => {
222+
const OWN = { id: 'root', logic: 'and', conditions: [{ id: 'view-0', field: 'name', operator: 'contains', value: 'Acme' }] };
223+
const withOwn = { viewDefaults: { ...VIEW_DEFAULTS, filters: OWN } as never };
224+
225+
it('the panel holding the view\'s own rows reports no part', async () => {
226+
const { reported, onPersonalizationChange } = mount({}, { ...withOwn, initialFilters: OWN as never });
227+
await waitFor(() => expect(onPersonalizationChange).toHaveBeenCalled());
228+
await waitFor(() => expect(reported()).toEqual([]));
229+
});
230+
231+
it('an edited panel is `filters`', async () => {
232+
const edited = { ...OWN, conditions: [{ ...OWN.conditions[0], value: 'Globex' }] };
233+
const { reported } = mount({}, { ...withOwn, initialFilters: edited as never });
234+
await waitFor(() => expect(reported()).toEqual(['filters']));
235+
});
236+
237+
it('an emptied panel is `filters` too', async () => {
238+
const { reported } = mount({}, { ...withOwn, initialFilters: { id: 'root', logic: 'and', conditions: [] } as never });
239+
await waitFor(() => expect(reported()).toEqual(['filters']));
240+
});
241+
});

0 commit comments

Comments
 (0)