Repository navigation
feat(console): the object list keeps the page a reader turned to, in the address - #31229
Merged
Merged
Conversation
ListView takes a controlled page (page / onPageChange). The console's object page binds it to the uf__page param, written with replace, so Back from a record opened as a full page, a reload and a copied link land on the page the reader left. The list's reset to page 1 clears the param, and a page past the end still clamps to the last reachable one. The page's search-param writes now chain until the location moves, so the reset a query change causes no longer drops that change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pnaew3QBpfvsdUhfi
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pnaew3QBpfvsdUhfi
…-page test Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pnaew3QBpfvsdUhfi
Contributor
Author
|
domain:ui#1 · os-project-manager · session_01FEkQ5nLA7wiVY5YWjT9Svr Contract reviewServed-tier: The lane seat's own review of record, owed by the ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
Contributor
Author
|
domain:ui#1 · os-project-manager · session_01FEkQ5nLA7wiVY5YWjT9Svr 席位核对 · ACCEPT · 2026-11-07T18:54Z · head
|
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 Leehom · project thread
Fixes #30850
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
uf__page,用 replace 写,不新增历史记录)。翻到第 2 页、整页打开一条记录、再按返回,列表回到第 2 页;刷新和复制链接也落在同一页。手机上卡片列表的翻页同样生效。ListView新增两个宿主属性page/onPageChange(受控页码,和sort由宿主持有同一思路),不传时行为不变。useState(1),返回后总是第 1 页。手机上每条记录都整页打开,所以手机用户每看一条就回到第 1 页。setSearchParams基于上一次渲染的参数,在第 2 页输入搜索词时,搜索写入和随之触发的「回第 1 页」写入会互相覆盖,搜索词丢失。现在ObjectView的写入在地址变化前串联。回滚即 revert。ui/packages/app-shell/src/views/ObjectView.tsx(写入串联,风险最高的一段),ui/packages/plugin-list/src/ListView.tsx(受控页码与setServerPage),ui/packages/app-shell/src/views/userFilterUrlState.ts(uf__page的读写)。pnpm --dir ui exec vitest run packages/app-shell/src/views/ObjectView.listPageInUrl-30850.test.tsx,预期Tests 6 passed (6)。What changes
@object-ui/plugin-list— a controlled page.ListViewdeclares two host props,pageandonPageChange. Passingpagemakes the page controlled: the list reads it every render and asks for every move throughonPageChange(the pager; the existing reset to page 1 when the object, filters, sort, search, grouping, page size or view change; the existing clamp to the last reachable page when a load comes back empty past the end).setServerPagestays the one door every move goes through; it is now stable and reads the latest committed page and host callback through a ref set in a layout effect, because the fetch effect's clamp and the sort handlers call it from closures taken renders ago. A move to the page already shown calls nothing. Withoutpagethe list keeps its page itself, exactly as before, andonPageChangeonly reports the move. Both props are destructured by name, so neither rides the{...props}forward into the view component.@object-ui/app-shell— the binding. The list's page joins theuf_list-state family asuf__page(LIST_PAGE_PARAM), owned byuserFilterUrlState.ts.parseListPageParamreads it strictly: a whole number from 1 up, else page 1.applyListStateParams({ page })writes a page past 1 and deletes the param for page 1 ornull.useObjectViewListUrlStatereads it from the address every render (listPage), andobjectViewListRendererpasses it toListViewaspage, withonPageChangewriting back throughwriteListUrlState({ page }), which replaces the entry.urlParams.ts.RESERVED_URL_PARAMSdoes not holduf__page(pinned). The bare namepagewas not taken: theAppContentdocblock aboveRECORD_NAMED_PAGE_ROUTErecordspageas a page-scoped list parameter "elsewhere", and theuf_family is where the object list already keeps its search, sort, filter and grouping, so the sign-out return link (withoutListStateParams) and "Reset to view" drop it with the rest without new code paths.uf__pageis left out ofuserFilterParamsKey, so a page alone never makes an address read as a link that carries list state (which would skip the reader's stored sort and filters), and out ofparseUserFilterParams, so it is never read as a quick-filter chip on a field named_page. It is not part of the seed: it is read live on every render.ObjectView. React Router's functionalsetSearchParamsstarts from the params it last rendered, and the navigation commits in a transition. A search typed on page 2 wroteuf__search, then the list's reset wrote "deleteuf__page" from the same stale params, and the search term was lost (the real-router test below caught it).ObjectView's one setter now starts each write from the previous write untillocation.keymoves. It serves every writer on the page (list state, quick-filter chips, the drawer'srecordId), so a chip change on page 2 is covered by the same fix.ui/packages/plugin-list/README.md): a "Host props:pageandonPageChange" section beside the other host props..changeset/30850-list-page-in-url.md:@object-ui/plugin-listand@object-ui/app-shellpatch,Clause-②: yes (widening)(plugin-list's publishedListViewPropsgains two optional props; app-shell's module exports gainLIST_PAGE_PARAMandparseListPageParam),Metadata-protocol: none. No i18n key is added, changed or removed.Why
Ruling 6708434746 (maintainer 「同意」 to A): the list page goes in the URL as a page-scoped param named against
urlParams.ts, written withreplace, cleared by the reset-to-1 rule. The record route is a sibling of the list route inAppContent, so a record opened as a full page unmountsObjectViewandListView, and the list'suseState(1)page started over on Back. On a phone every record opens as a page (#27058), so every phone reader lost their place after each record.Phone measurement first (the ruling's precondition). The phone list pages; it does not load on scroll.
ObjectGrid's card face (below the app breakpoint) ends inobject-grid-card-pager, which calls the samemanualOnPageChangethe table's pager does, and there is no scroll or intersection loader in the card path. Measured in a rendered test at 390 px through the realObjectViewand grid: the card pager is drawn, its Next turns to page 2 ($skip10), and Back from the record page lands on page 2 withPage 2 of 3. So no batch or scroll restore is owed. Not measured on a physical device or a live Console at phone width.Tests
ui/packages/app-shell/src/views/ObjectView.listPageInUrl-30850.test.tsx(6 cases). This page,plugin-view'sObjectView,plugin-list'sListViewandplugin-grid's grid and card list render for real under aMemoryRouterwhose record route is the list route's sibling, as inAppContent. Every step is a click (fireEvent) and the window the list asked for is read at the data source:uf__page=2,$skip10, every navigationREPLACE; the row's ↗ "Open as full page" → the record route, list unmounted; Back →uf__page=2, the remounted list asks only for$skip10, the pager readsPage 2 of 3; one more Back leaves the list;Page 2 of 3on the card pager;uf__page=3asks only for$skip20;uf__searchwritten,uf__pagegone, the window{ skip: 0, search };uf__page=40clamps to page 3 and the address follows;uf__page=twoopens page 1.ui/packages/plugin-list/src/__tests__/ListView.controlledPage-30850.test.tsx(7 cases, stub grid as inListView.serverPagination.test.tsx): opens on the host's page with no page-1 window first; a pager move goes to the host and the window follows the value passed back; control: a host that does not pass the move back keeps the list where it is, no refetch; a query change sends the host back to 1; past the end clamps through the host; a move to the page already shown calls nothing; control: uncontrolled keeps its own page and still reports the move.ui/packages/app-shell/src/views/userFilterUrlState.listPage-30850.test.ts(7 cases): the spelling and no collision withRESERVED_URL_PARAMS; strict reading (0,-2,2.5,1e3,2,02,two, a 30-digit value all read as 1); page 1 andnulldelete, a patch withoutpageleaves it; not a chip; not inuserFilterParamsKey; dropped by bothwithoutListStateParams.Acceptance notes
ListViewcomponent state (no host stores it, before or after this change). Picking one resets to page 1 and clears the param, but after a full-page open and Back the list returns to the declared or default size whileuf__pagekeeps its number, so the page number then counts windows of that size. Within the ruling's scope (the page only); noted, not filed.uf__pagestays in the address until the next move writes the param; it opens page 1 and changes nothing else. The otheruf_params are rewritten on load by the seed; the page has no seed by design.ObjectView's search params, not only the list's. It changes nothing when writes are already a render apart (the base is then the rendered params, as before); it only stops a second write in the same window from undoing the first.Verification
Base
8ef4d309(origin/mainwhen the branch was cut). Heavy runs throughscripts/pm/os-verify-lock.sh.Suites and type-checks
pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' --filter '@object-ui/plugin-list^...' build, VERDICT command-exit 0.pnpm --dir ui exec vitest run --maxWorkers=3 --reporter=dot packages/plugin-list/plus the 171 app-shell test files that importObjectView,userFilterUrlState,objectViewListUrlState,objectViewListRendererorplugin-list(oned830606; head5793838ediffers only by one test-file import): Test Files 343 passed (343), Tests 3749 passed (3749), VERDICT command-exit 0. The whole app-shell suite (2,212 files) is left to CI's Test UI.5793838e: Test Files 3 passed (3), Tests 20 passed (20), VERDICT command-exit 0.pnpm --filter @object-ui/plugin-list run type-checkandpnpm --filter @object-ui/app-shell run type-check(eachtsc --noEmitandtsc -p tsconfig.test.json): exit 0.pnpm --dir ui exec eslintover the eight touched or new source and test files: exit 0, 0 errors.Ablations (3, each red, each restored)
Each through
scripts/ablation-replace.mjs: anchor hit once, mutation proven on disk by anchor count and blob change, restore proven by blob == HEAD andgit diff HEADempty. ui vitest aliases@object-ui/plugin-listtosrc, so no build sits on the path.ListViewignorespage(const serverPage = ownPage;)ObjectViewwrites stop chaining (pending && false)uf__pagecounted inuserFilterParamsKeyA3's first attempt was refused by the tool before running (its replacement text already occurred in the file, so the count could not rise); it was rerun with a distinct replacement, and the reading above is the rerun.
Derived gates (dispatch-gates --commands, 36 families, plus 4)
All on head
5793838e, exit codes captured before any pipe.dispatch-gates.mjs --ran: "36 derived famil(ies) accounted for — 36 run, 0 NOT-MEASURED".pnpm --dir ui exec vitest run scripts/: Test Files 170 passed | 2 skipped (172), Tests 4996 passed | 2 skipped (4998).pnpm --dir ui check:new-line-citations(0 new citations).ed830606) had one red:check:test-source-aliasasked the new ObjectView test to load@objectstack/lintat module top, sinceObjectViewreaches a dynamicimport('@objectstack/lint')throughcelAuthoring.ts.5793838eadds that import; every family was then rerun.Human Minimum
packages/specholds no runtime logic. (Not touched.)pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Signed: domain:ui#1 · os-project-manager · session_01FEkQ5pnaew3QBpfvsdUhfi
Generated by Claude Code