Skip to content

feat(studio): metadata list filters, sort and scroll ride the list address - #36939

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-36896-list-state-in-url
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-36896-list-state-in-url

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread
Fixes #36896
Part of #36890

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:Setup 和 Studio 里的元数据列表,搜索词、来源、仅看定制、启用状态和新加的排序都记在地址里;点进某一项再返回,筛选和滚动位置都还在,刷新页面筛选也不丢。
  • 为什么做:属于「Studio 重构」专题,详情页的上一个、下一个要按列表当前的筛选和排序走,这张卡先把列表这一半做好。
  • 出错会怎样:最坏是列表的筛选或排序显示不对、返回时没回到原来的位置;数据不受影响,可以直接撤回这个改动。
  • 要你做什么:无。

What changes

On the existing table (no table swap), in ui/packages/app-shell/src/views/metadata-admin/:

  • ResourceListPage.tsx — the search text, source filter, "only customizations" and the activation status filter move from component state into the list's URL as page-scoped params: q, source (artifact / runtime), customized=1, status (active / inactive), plus the new sort. A value at its default is left out (an untouched list keeps its clean address). Every write is a replace, never a push, so typing never floods history and Back leaves the list. package and scope keep their params and meaning; the "source package" the card names is that existing package scope. The search box keeps a local draft that follows the address only on a navigation the page did not write (PUSH / POP), because the router commits locations in a transition and an echo would otherwise reset the caret mid-typing.
  • Sort — a new control: by API name or by label, each way. The default is by API name, A to Z (before: the server's order). The seam for the modified-time sort is one entry in LIST_SORT_KEYS plus one reader member; nothing depends on the sibling-field card.
  • Row links carry the list's non-default params to the detail address (epic decision 10), after package / scope / member. No "from Studio" marker exists in the address today, so none is added (decision 15 belongs to the detail-header card).
  • Scroll — useListScrollRestore.ts: the list's position is kept in memory per list address (path plus query) and restored once the rows are drawn when the same address is shown again (Back, or a link to the list with the same params). The scroller is the nearest vertically scrolling ancestor, else the page, so Setup and the Studio area behave alike. Positions are recorded only after the restore, so the clamp a loading page causes never overwrites one.
  • metadataListState.ts (new, pure) — the codec (decodeListState / writeListState / listContextQuery / hasListContext), the package scope (scopeListRows), the filter and sort (applyListState) and orderedListNames. The page draws through applyListState, so the list and the detail order cannot disagree. Sorting compares in the reader's display locale (Intl.Collator, numeric, case-insensitive), ties broken by name then input order.
  • useListOrderedNames.ts (new) — useListOrderedNames(type) returns { status, names, fromList } for the detail open at the current address: the type's list under the filter and sort the address carries, read the way the list reads it (area package plus its .custom pair, ?scope=environment, or ?package=). With no list context (refresh, shared link, ⌘K) the names are every item of the scope by API name. names is the readonly string[] that the detail-header composite's sequence.names takes (read from claude/issue-36892-studio-detail-header, no PR open yet, not edited).
  • i18n — five strings for the sort control in the studio catalogue (en, zh).

StudioDesignSurface.tsx is not touched.

Tests

New files, named for the card:

  • metadataListState-36896.test.ts — codec round trip (through the address string, beside params it does not own), defaults omitted, unknown values read as defaults, no collision with the reserved console params or the item page's params; ordered names with no context (by API name, numbers in number order), with a filter and a sort, offered vs not-offered filters, rows sharing a name, the package scope.
  • useListScrollRestore-36896.test.tsx — scrolled, left for a detail, mounted loading (box clamps), rows drawn: back at the position; another address starts at the top.
  • ResourceListPage.listStateInUrl-36896.test.tsx — the real page and hook: an address with a search and a sort draws the list filtered and sorted (what a refresh replays); typing writes q with a REPLACE; a row link carries the context and an untouched list's carries none; open a row and Back lands on the same filtered list; the hook's order with a context, with none, and under a package.

No existing test pinned the old component-state behaviour; none was changed.

Acceptance notes

  • Rows that share a name (bundle members, permission sets with two holders) are one entry in the ordered names, at the first row's place: ‹ › open an item by name. A member-aware sequence would need the header's sequence to carry more than names.
  • Scroll positions are per tab and in memory: a full refresh starts at the top (the filters survive it through the address).
  • On the cross-package leg a row link carries ?package=X, which moves the detail onto X's leg (areaLocationRedirect), so the detail's order there is X's list, not the cross-package one. Unchanged by this PR; noted for the ‹ › card.
  • Screenshots: none attached. The card's acceptance is behavioural (filters and scroll survive a round trip and a refresh) and is pinned by the tests above; the only new pixels are one sort select in the existing filter row.
  • No docs page describes this list's filters today; the epic's walkthrough-and-docs card owns that.

Verification

Read first, by risk: ResourceListPage.tsx (the search draft effect and updateListState), useListScrollRestore.ts (record-after-restore), useListOrderedNames.ts (scope resolution).

Two-minute check: open Setup, a metadata list with several items, type in the search box and pick "Label (Z–A)"; the address gains q= and sort=-label. Scroll down, open an item, press Back: the same filtered, sorted list at the same scroll position. Refresh: the filters are still applied.

All readings below at head 234dc13a6 unless named.

Targeted tests — 24 files, 215 tests, pass
pnpm --dir ui exec vitest run --maxWorkers=2 (3 new files, machineLocaleCensus-9909, every ResourceListPage.*.test, metadataAreaHost.*, walledCatalogReadOnly-12183, anchors.validation-retired, ResourceEditPage.picklistReadOnly-10202, StudioMetadataArea.*, StudioDesignSurface.metadataArea-28561)
 Test Files  24 passed (24)
      Tests  215 passed (215)
os-verify-lock: VERDICT command-exit 0
Typecheck — app-shell, src and tests, pass (311972e, before the main merge)
pnpm --filter @object-ui/app-shell run type-check
os-verify-lock: VERDICT command-exit 0
Ablations — two, each red, each restored to HEAD
ResourceListPage.tsx: row link's list context replaced by ''
  ok mutation landed: anchor 1 -> 0
  x a row link carries the list context; an untouched list carries none
  Tests 1 failed | 7 passed (8)
  ok restored: blob == HEAD and git diff HEAD is empty

useListScrollRestore.ts: record guard 'if (restoredRef.current)' replaced by 'if (true)'
  ok mutation landed: anchor 1 -> 0
  x comes back where it was, at the same address, once the rows are drawn
  Tests 1 failed | 2 passed (3)
  ok restored: blob == HEAD and git diff HEAD is empty

A first try of the second ablation used a replacement that is a substring of its anchor; ablation-replace refused it before running (count 1 -> 1) and it was redone as above.

Derived gates — 38 of 38 exit 0; --ran reconciliation 38 run, 0 unrun
node scripts/pm/dispatch-gates.mjs --commands  (38 commands, run in full at 26cfd99cf..311972ea1)
every command :: exit 0, including pnpm --dir ui exec vitest run scripts/ (172 passed, 2 skipped files)
dispatch-gates --ran: 38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED
re-run on 311972ea1: check:new-line-citations, check:doc-authoring, check:type-check-debt,
  check:type-check-coverage, check:test-source-alias, check:cross-package-test-inputs, check:nul-bytes,
  check:undeclared-dep-imports, check:published-files, check-empty-changeset, check-closing-keyword-parity :: exit 0
eslint (touched files): 0 errors
overlap-check: VERDICT clean exit 0 (origin/main 4f19091997 and 4 open PRs sharing the studio catalogue)

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzgNtKtppbRbXmHGH8x

…dress

The list's search, source, customized-only, status filter and a new sort
live in URL params (replace, not push); row links carry them to the detail;
a pure filter/sort module and a hook give the detail its ordered names.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzgNtKtppbRbXmHGH8x
…ts state in an effect

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzgNtKtppbRbXmHGH8x
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 24, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgv4KRPATgwPAzKKMU

席位核对 — ACCEPT · repo:objectstack#3 · head 234dc13 · 2026-11-24T10:24Z

L1: ACCEPT
Head-sha: 234dc13a6297e80467b5424b50231de681471ca0
Reviewer: L1-b (seat 3, area ux-E2). Contract review: none owed. Clause-②: no, Metadata-protocol: none, no packages/spec/src/**, no governed rule text.
Tier: not Tier H. This is card #36896's only PR, 10 files, +1185/−45 (1,230 lines, under the 3,000-line per-card line). check-governed-merges --pr 36939: not governed.

Read

Checklist

  • Shape. Draft, base main, first line Fixes #36896, plus Part of #36890.
  • Scope. metadataListState.ts (new, pure), useListOrderedNames.ts and useListScrollRestore.ts (new), ResourceListPage.tsx, three test files, and five en/zh engine.list.sort* keys. All are inside the claim surface. The table component is not replaced, which the card rules out.
  • State in the address. q, source, customized, status and sort are decoded by decodeListState and written by updateListState with replace, so filtering adds no history entries. The search draft follows the address only on a non-REPLACE navigation, so typing is not overwritten by its own write. package and scope keep their old handling.
  • Ordered names match the list. The list and the hook both go through scopeListRows and applyListState. The sort uses one Intl.Collator in the display locale (numeric, base sensitivity), with ties broken by name and then input order, so the two orders cannot drift apart. The label sort reads the served item.label, the same text the row shows.
  • Scope parity. I checked the four scopes against each other.
    • Environment scope: both are unscoped.
    • Studio area with a package: both use host.packageId, plus the .custom pair.
    • The area's cross-package leg (host.packageId === null): the list sets unscoped through allLeg, and the hook gets activePackage === null, so both are unscoped. The row link carries the row's own ?package=, which the hook ignores under a host.
    • Setup with no host: the list scopes to its picked package. The repair effect then writes that package to ?package=, and every row link carries ?package= (the row's own, or pkgSuffix). So the detail's hook reads the same package the list showed.
  • Direct open (refresh, share, ⌘K). With no list context the state decodes to the default, API name A–Z, so the names come in name order as decision 10 says. fromList tells the caller which case applies.
  • Scroll. useListScrollRestore is keyed on pathname?search and only restores once rows have loaded and the filtered list is non-empty, so a restore never lands on an empty list.
  • Changeset. @object-ui/app-shell and @object-ui/i18n patch, Metadata-protocol: none. That is right: no published schema moves. The body states the default order change (API name A–Z).
  • i18n. The five keys are present in both en and zh, and the zh text reads naturally (排序, API 名称(A–Z), 显示名(A–Z)…).
  • Card acceptance.

Findings

No must-fix, no should-fix.

  • N1 (nit). The merge commit 234dc13a has no Co-Authored-By / Claude-Session trailers. The other five commits have them. Squash merge drops it anyway.
  • N2 (nit). The hook's doc comment says an address that names no package lists every package's items. In Setup that case is only brief: the repair effect writes ?package=, and row links always carry one. A clause saying so would stop a later reader treating it as a real unscoped Setup leg.
  • N3 (nit). The PR has no screenshots of the sort control. The acceptance is behavioural and pinned by tests, so this is not needed for the verdict. The first live walk of epic 专题:Studio 重构——某个应用的开发界面:左侧按类型分组的菜单 → 列表 → 右侧全屏详情(去掉顶部分区) #36890 should look at the sort Select's place in the toolbar.

Note to the seat

  • Not Tier H and no L2 owed, so the seat can land this through the relay when it is ready. Fixes #36896 closes the card at merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgNtKtppbRbXmHGH8x

Landing: 2026-11-24T10:26Z · head 234dc13 · L1 ACCEPT 7128761676 (nits only: merge-commit trailers, hook doc wording on the no-package case, no sort-control screenshot)

Probe Reading
check-governed-merges.mjs --pr 36939 NOT governed — 0 of 10 paths hit the register; 1230 changed lines (+1185 / -45) ≤ 3000; the card's only PR
landing-k.mjs --pr 36939 CAN'T ANSWER (UI-only: no Test Core planner ran, no affected-set base); K read via merge-base instead: 5 commits behind origin/main (< 15, no main merge needed)
checks at head 45 success / 13 skipped / 0 failing (10:21Z)

State: ready + auto-merge via the relay; on MERGED, #36896 closes by Fixes and pm:dispatched comes off with a close-out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants