Repository navigation
fix(plugin-list, app-shell): "Reset to view default" clears the stored list setting instead of copying the view into it - #29044
Merged
Conversation
…tored list preference Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTivKAK8N8dfW5mn9D
… host seam Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTivKAK8N8dfW5mn9D
…trol Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTivKAK8N8dfW5mn9D
Contributor
Author
|
domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu 席位核对 · ACCEPT · 2026-11-02T06:34ZHead-sha:
|
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #28948
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
ui/的plugin-list(ListView新增宿主属性onRestoreViewDefaults,viewDefaults多一个sort)和app-shell(对象页接上这两个属性,恢复时把对应部分置空)。不动 spec、服务端和元数据。读者主动的「不排序」(sort: [])和「显示全部列」(hiddenFields: [])照旧保存。不接新属性的宿主行为不变。回滚 = revert 本 PR。ui/packages/plugin-list/src/ListView.tsx的resetDisplayToViewDefault与handleResetSort;ui/packages/app-shell/src/views/objectViewListRenderer.tsx的restoreViewDefaults;新测试ListView.restoreViewDefaults-28948.test.tsx。pnpm --dir ui exec vitest run packages/plugin-list/src/__tests__/ListView.restoreViewDefaults-28948.test.tsx packages/app-shell/src/views/ObjectView.userListState-12418.test.tsx,应 2 个文件全部通过(6 + 32 个用例);或在 Console 线索列表改行高后点「恢复视图默认设置」,该用户的sys_user_preference条目里不再有rowHeight。What changes
@object-ui/plugin-list—ListViewonRestoreViewDefaults(parts), wherepartsis drawn from'sort' | 'hiddenFields' | 'rowHeight'. When a host wires it, the Display control's "Reset to view default" and the sort popover's "Reset to view default" call it with the parts they returned to the view's own, in one call, and no longer write the view's values throughonHiddenFieldsChange,schema.onDensityChangeoronSortChangefor those parts. The list puts the view's sort and hidden fields back at once; the table density followsschema.rowHeightonce the host's clear lays the view's own back there.viewDefaultsgainssort(a pick ofListViewSchema'shiddenFields,rowHeightandsort). The sort popover's reset compares against it (enabled state, whether it is drawn) and restores it. As with the other two members, a passedviewDefaultsis the whole baseline: an absentsortmeans the view declares none.onRestoreViewDefaults(and withoutviewDefaults), both resets behave exactly as before. Layout, grouping, row color, row numbers, inline edit and the gallery card size reset as before in every case.@object-ui/app-shell— the object page's listviewDefaults.sort(the view's own sort, under the link's or user's stored sort that thesortrung lays over it) and wiresonRestoreViewDefaultstorestoreViewDefaults, which patches each named part tonullon the user's list state (listPrefs.patchView).patchViewPreferencealready treatsnullas a clear and removes a view left with nothing, so "Reset view" disappears with the last part. A sort reset also takes the sort off the URL (writeListUrlState({ sort: null })).ListPreferencesProvider: docblock only —ListViewPreferencePatchnow names the list's per-part reset as the second way back to the view's own.Tests
ui/packages/plugin-list/src/__tests__/ListView.restoreViewDefaults-28948.test.tsx(new, 6 cases): the Display reset nameshiddenFieldsand calls noonHiddenFieldsChange; namesrowHeight, calls noonDensityChange, and follows the host's re-renderedschema.rowHeight; both differ ⇒ one call naming both; the sort reset returns toviewDefaults.sort(server$orderbymoves from the user's to the view's), namessort, calls noonSortChange; CONTROL: removing the last sort level still emitsonSortChange([]); CONTROL: row numbers reset without naming anything.ui/packages/app-shell/src/views/ObjectView.userListState-12418.test.tsx— new describe at the host seam (realObjectView, realListPreferencesProvider, recorded list-state family), 6 cases: the list is wired and handed the view's sort; a Display reset leaves neither density nor hidden fields in the saved row; after it, a changed viewrowHeight/hiddenFieldsreaches the user on the next open; a sort reset with nothing else stored saves{}and the ⋯ "Reset view" entry goes; after it, a changed view sort reaches the user; CONTROL: a deliberatesort: []andhiddenFields: []are saved and survive a reload. The threeviewDefaultsequality pins now includesort; the old "the list's reset writes through the doors" case is renamed to what it pins (a choice equal to the view's own is stored as a choice).Ablation (scripts/ablation-replace.mjs, source-resolved, no dist)
if (onRestoreViewDefaults) onRestoreViewDefaults(['sort']); else emitSortChange(restored);toemitSortChange(restored);): 1 failed (the sort reset case), 5 passed. Restored, blob equal to HEAD,git diff HEADempty.else if (onRestoreViewDefaults)branch dropped, so the density goes throughdensity.setMode): 2 failed (the density case, the both-parts case), 4 passed. Restored, blob equal to HEAD,git diff HEADempty.patch[part] = nullto the view's value per part): 4 failed in the host file (both "leaves nothing stored" cases and both "follows the view on the next open" cases), 28 passed. Restored, blob equal to HEAD,git diff HEADempty.Acceptance notes
sortrung's old comment. It now returns to the view's own sort, which is what its label says and what a reload shows once the stored sort is cleared; "Reset view" already did this.onRestoreViewDefaultsdoes not set the density locally; it waits for the host to clearrowHeight. A host wiring the prop must clear what it is named, which the docblock says.sortparam removal on a sort reset (the harness'sMemoryRouterURL is not read by these tests).Verification
All on the final head
eda72c06(baseorigin/mainfed3a51b), afterpnpm install --frozen-lockfileandturbo run build --filter='@object-ui/app-shell^...' --filter='@object-ui/plugin-list^...'plus formula, sdui-parser, lint and client (64 tasks, exit 0), underscripts/pm/os-verify-lock.sh.packages/plugin-list/vitest suite plus 16 app-shell / console / plugin-view test files that name the touched modules or props (git grep -lofobjectViewListRenderer,ListPreferencesProvider,viewDefaults,listPrefs,patchView,onHiddenFieldsChange,onDensityChange, the two reset test ids),--maxWorkers=2: 196 files, 1907 tests passed. A declared narrowing for app-shell; CI's Test UI runs the rest.pnpm --filter @object-ui/plugin-list run type-checkandpnpm --filter @object-ui/app-shell run type-check(the test programs included): exit 0.node scripts/pm/dispatch-gates.mjs --commands): 35 of 35 run, each exit 0 (check:type-check-debtandpnpm --dir ui exec vitest run scripts/under the lock; the latter 169 files passed, 2 skipped), includingnode scripts/check-sdui-manifest.mjsand the PR-body gates with this body asGITHUB_EVENT_PATH.--ranreconciles 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN.check-partof-closing-keywordwithPR_BODY: exit 0.uicheck:new-line-citations: 0 new citations.origin/mainmoved toab085a04since the base; none of its commits touch the five changed files, so no merge was taken before opening.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jTivKAK8N8dfW5mn9D