Repository navigation
Commit 047e1dc
fix(console): the /data page keeps its list's search, sort, grouping and Filter panel in the address (#36571)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9GPJ8pmbK219Pay95x25Uno)_
Fixes #36408
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:在对象的「数据」页上,读者的搜索、排序、分组和筛选面板条件,打开一条记录再关闭、或刷新页面之后都还在,地址栏也能直接复制分享。
- 为什么做:列表体验收口——数据页此前每打开一条记录就丢掉读者的搜索,只能重新输入;对象列表早已保留这些,这里补齐同样的做法。
- 出错会怎样:数据页的读者可能看到一个他没想要的搜索或筛选还在生效;页面的「已筛选」标签与「重置」照常可用,合并可直接回滚撤销。
- 要你做什么:无。
## What changes
`ObjectDataPage` (`/apps/APP/OBJECT/data`) now keeps its list's own
state in the address, under the keys `ObjectView` already uses and
through the same reader and writer (`parseListStateParams` /
`applyListStateParams` from `userFilterUrlState.ts`, reused unchanged;
`objectViewListUrlState.ts` is not touched):
| What | Param | How the list reads it | How a change is written |
|---|---|---|---|
| search | `uf__search` | `initialSearchTerm` | `onSearchChange`,
replace |
| sort | `uf__sort` | `schema.sort` | `onSortChange`, replace; an
emptied sort deletes the param (no sort is this page's default) |
| grouping | `uf__group` | `schema.grouping` | `onGroupingChange`,
replace |
| Filter panel | `uf__filter` | `initialFilters` | `onFilterChange`,
replace |
Opening a record already carried the page's address as the record page's
origin (`listOriginOf`), so its close, a reload and a copied link now
open the list as the reader left it. `/data` has no pager (measured in
#36299's report), so `uf__page` is not wired.
**The design point, as settled in the claim (two layers, no new
spelling).** `filter[...]` stays the page's own address conditions: the
removable 「Filtered by」 tags, what 「Reset」 puts back to the source, and
what "Save as view" saves (unchanged here). `uf__filter` is the Filter
panel on top of them, exactly as `ObjectView` keeps its panel on top of
the view's filter. `ListView` applies both (the conditions AND the
panel); nothing writes one from the other. No case was measured where
the two layers conflict: a panel condition on the same field as a
`filter[...]` tag simply narrows further (AND), the same as a panel
condition over a view filter on the object list.
**Seed.** The state is read from the address once per object and list
generation (the `ListView` props it feeds are one-shot), through
`ObjectView`'s field gate (a field the object does not declare, or one
the reader cannot read once permissions are loaded, is dropped), and a
`uf__filter` that loses any condition to the checks is refused whole
with `ObjectView`'s notice (`console.objectView.linkFilterRefused`,
objectstack#31869's posture). The seed is then written back (replace) so
the address shows what the list shows. Unlike `ObjectView`
(objectstack#35955), a reload is not a reset here: `/data` has no view
to return to and no draft store, and the card's acceptance asks for
reload survival.
**`viewDefaults`.** `schema.sort` / `schema.grouping` now carry the
address's state, so the page hands `ListView` its own defaults apart
(`DATA_PAGE_LIST_DEFAULTS`: no sort, no grouping; hidden fields and row
height left unset, which is what the page's schema already had). The
list therefore still draws no 「Reset to default」 for a sort nobody
declared, and judges a reader-added grouping level as the reader's.
**`resetToSource` (the PM's mechanism assumption, measured).**
`resetToSource` and `conditionsAreSourced` match the `uf_` prefix, so
the `uf__*` keys are cleared by 「Reset」 and counted by its enabled
state, as the claim assumed. That is the wanted behaviour (back to the
list as the related list opened it), but clearing the address alone was
not enough: `ListView` takes its search and panel once, at mount, so the
list kept applying a search the address no longer carried. 「Reset」 now
also moves a list generation (`key` on `ListView`), so the list remounts
on an empty seed with no search, sort, grouping, panel or quick-filter
selection. That seed deliberately writes nothing back: the router
commits the reset's navigation in a transition, and a write-back from
the render that still read the old location put the removed
`filter[status]` back (caught by the Reset pin below before the fix).
**The L567 comment.** Its intent was #2251's "nothing here writes back
to any saved view": the schema-level `onSortChange` / `onFilterChange`
hooks are the ones `ObjectView`'s relay uses to persist a view. That
stays true; the comment now says the list's own changes go to the
address only, through `ListView`'s host callbacks.
Files to read first, by risk:
1. `ui/packages/app-shell/src/views/ObjectDataPage.tsx` — the seed block
(`listSeedRef`, the write-back effect and its reset skip), then
`resetToSource`.
2. `ui/packages/app-shell/src/views/ObjectDataPage.tsx` — the `ListView`
props (`key`, `viewDefaults`, the four callbacks) and the schema's
`sort` / `grouping` rungs.
3.
`ui/packages/app-shell/src/views/ObjectDataPage.openRule-35875.test.tsx`
— the new top-level `describe`.
## Tests
The pins go into the page's existing open/close harness
(`ObjectDataPage.openRule-35875.test.tsx`) as one new top-level
`describe`, driven through the real `ObjectDataPage`, `ListView` grid
and `MePermissionsProvider`:
- the card's pin: a search typed in the toolbar, the record opened by
its name and closed with the page's ✕: the origin carries `uf__search`,
the list the close returns to still sends `$search` and shows the term;
- a reload of an address with `filter[status]`, `uf__search`, `uf__sort`
and `uf__filter`: the query carries the search, the sort, and both
layers' conditions; the address keeps both layers as they came; the
panel condition draws no 「Filtered by」 tag; all of it survives an open
and close;
- a reload of an address with `uf__group`: the grid asks for its groups
by that field, the address keeps it;
- CONTROL: an address without list state sends no search, sort or
grouping and gets none written;
- a `uf__filter` naming an undeclared field is refused whole and leaves
the address, `filter[...]` untouched;
- 「Reset」 to the source: `uf__search` leaves the address and the list
stops searching;
- a sort the reader removes leaves the address, and no 「Reset to
default」 is drawn.
No existing test was changed.
<details><summary>Runs</summary>
- `cd ui && pnpm exec vitest run --maxWorkers=2
packages/app-shell/src/views/ObjectDataPage` (under `os-verify-lock`,
after the `origin/main` merge, head `1a95ac7a`): `Test Files 9 passed
(9)`, `Tests 96 passed (96)` (89 before this PR, all still green).
- Ablation, one behaviour: the search write `onSearchChange={(search:
string) => writeListUrlState({ search })}` replaced by
`onSearchChange={() => undefined}` through
`scripts/ablation-replace.mjs` (anchor x1 -> x0, blob b524303 ->
d168962bdeb0): `× a search, then a record opened and closed: the search
is still applied`, `Tests 1 failed | 6 passed | 8 skipped`; restored,
blob == HEAD, `git diff HEAD` empty. The test imports the page from
source, so no build stands between the mutation and the run.
- `pnpm run type-check` in `ui/packages/app-shell` (both `tsc --noEmit`
and `tsconfig.test.json`, whose `include` is `src/**/*.test.ts(x)`, so
the new pins are compiled), after building the
`@object-ui/app-shell^...` closure (68/68): exit 0, under
`os-verify-lock` (VERDICT command-exit 0).
</details>
## Acceptance notes
- The refused-panel notice reuses `ObjectView`'s string, which says the
list "shows the view without it"; on `/data` there is no saved view. Not
a new key, to keep this PR off the locale packs.
- "Save as view" saves the `filter[...]` conditions only, as ruled; a
Filter panel condition, search, sort or grouping on `/data` is not
carried into the new view.
- Read from code, not measured: when the route moves from one object's
`/data` page straight to another's, the page stays mounted and
`ListView` is not remounted (unchanged here: it carries no object key),
so its one-shot search and panel are not re-read from the new address;
the seed for the new object's sort and grouping is. The quick-filter
selections (`uf_FIELD`) were already captured once per page mount the
same way. Console navigation reaches `/data` from a list or a related
list, which mounts the page afresh.
- Read from code, not measured: the phone list panels emit through the
same `ListView` callbacks, so they write the same params.
## Verification
Two minutes: open `/apps/APP/OBJECT/data` in the console, type a term in
the list's search, open a record by its name, press ✕ — the list comes
back still searching for it, and the address bar shows
`uf__search=TERM`; reload — still searching.
<details><summary>Local gates at 1a95ac7</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 38 families for this diff; each was
run after the last commit and every one exited 0 (`check:*` without the
lock, `pnpm --dir ui exec vitest run scripts/` under it: `Test Files 172
passed | 2 skipped`, `Tests 5127 passed | 2 skipped`). `--ran`
reconciliation: `38 derived famil(ies) accounted for — 38 run, 0
NOT-MEASURED`. `node scripts/pm/overlap-check.mjs
--branch=claude/issue-36408-data-page-list-state`: `VERDICT clean exit
0`. Every other family is CI's.
</details>
https://claude.ai/code/session_01ADHkmRGDrq6JSytBsNFabU
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f3bd5ad commit 047e1dc
3 files changed
Lines changed: 379 additions & 7 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
0 commit comments