Repository navigation
Commit 27c2f1e
fix(console): a list with no declared primary action keeps its header actions as buttons beside a long description (#34045)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JXjA9EsAjn7YUmjuHNUrgC)_
Fixes #33988
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么:** 列表页(和 `/data` 页)页头没有「声明的主操作」时(没有 New,也没有工具栏动作写 `variant:
'primary'`),不再把按钮折叠进「⋯」;按钮一直保留,长描述被截断。
- **为什么改:** objectui#12705 的折叠只保留声明的主操作。hotclm 的 `Launch Contract` 没声明为
primary,读者也没有 New,于是折叠后只剩「⋯」,英文长描述一占满就把唯一的按钮藏进菜单(卡里截图的菜单正是 `Launch
Contract`、`Add to favorites`)。
- **风险与回滚:** 只动 `@object-ui/app-shell` 三个文件的条件与注释,PageHeader
的折叠算法不变;有声明主操作的页面行为不变(objectui#12705
的测试原样通过)。没有主操作的页面在窄屏也不再折叠,按钮照常显示、标题和描述先截断。回滚 = revert。
- **先看:** `objectViewHeaderChrome.tsx` 里 `foldedHeaderActions`
的新条件;`ObjectDataPage.tsx` 的 `foldedActions`;测试
`ObjectView.headerFold-12705.test.tsx` 新增的 objectstack#33988 describe。
- **两分钟验证:** `pnpm --dir ui exec vitest run
packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx
packages/app-shell/src/views/ObjectDataPage.createAffordances.test.tsx`,预期全部通过;在没有
New、只有一个非 primary 工具栏动作、描述很长的列表页上,1440 宽下该动作仍是按钮。
- **需要你做的:** 无,席位落地。
## What changes
- **The list page offers its header a folded face only when it has a
primary to keep.** `useObjectViewHeaderChrome` builds
`foldedHeaderActions` only when the list draws New or has a list-toolbar
action authored `variant: 'primary'` (`declaredPrimaryToolbarAction`).
Otherwise it passes none, and `PageHeader` keeps `actions` at every
width (its documented behaviour for a page with no `foldedActions`); the
description truncates instead.
- **`/data` (`ObjectDataPage`) follows the same rule:** its folded face
(New labelled, Save as view in a `⋯`) is offered only when New is drawn.
An admin who cannot create keeps Save as view as a button.
- **`PageHeader`:** no code change; the `foldedActions` docblock now
says a page with no primary to keep labelled passes none.
- A list that declares a primary folds exactly as before; the
objectui#12705 pins are unchanged.
## Why
`PageHeader` folds when `actions` would clip the title or the
description, and the description counts at its full content width. The
list's folded face keeps one labelled action only when that action is
DECLARED primary; with none, the face is the `⋯` alone. So on hotclm's
`clm_contract` list (reader without create, one toolbar action `Launch
Contract` not authored primary, a 122-character English description),
the header folded at desktop width and moved the page's only action into
the menu, exactly the card's menu (`Launch Contract`, `Add to
favorites`). The PM hypothesis (the action bar measures what the title
block leaves) did not hold: the fold decision is `PageHeader`'s, and it
worked as designed; the gap was a folded face with nothing labelled in
it.
**Between phone and desktop widths** a list with no declared primary now
never folds: its actions stay labelled buttons, the description
truncates first and the title truncates inside its 60 % cap. The
schema-driven toolbar keeps its own `action:bar` overflow
(`maxVisible`), so many undeclared actions still collapse into that
bar's own menu, as before objectui#12705. Below `sm` the Console list
draws its phone header, which this change does not touch. To keep a
toolbar action labelled AND fold the others on a narrow header, author
it `variant: 'primary'`.
## Tests
- `ObjectView.headerFold-12705.test.tsx`, new top-level `describe` in
the existing harness (the same layout model as the objectui#12705 pins:
10 px per title character, 7 px per description character, 100 px per
labelled button): the card's object (no New for the reader, one
undeclared `Launch Contract`, the card's description) at a 1110 px, 1184
px (a 1440 px viewport less the 256 px sidebar) and 700 px header keeps
`Launch Contract` labelled, the `⋯` holds only `Add to favorites`, and
`data-folded` is absent. **CONTROL:** the same list with `Launch
Contract` authored `variant: 'primary'` still folds at 600 px and keeps
it labelled.
- `ObjectDataPage.createAffordances.test.tsx`, new top-level `describe`:
an admin who cannot create keeps Save as view as a button with no fold
offered; **CONTROL:** with New drawn the fold is offered
(`data-folded="false"`).
- **Forced test edits:** the `/data` harness's `useWorkspaceAdminStatus`
mock now reads a `workspaceAdmin` variable (default `false`, reset in
`beforeEach`), so the existing cases see the same value as before. The
`ObjectView` fold harness gains the module-top `import
'@objectstack/lint'` that `check:test-source-alias` asks of an edited
test file reaching `ObjectView`.
<details><summary>Runs, ablation and the wider suite (head
2daa61d)</summary>
- The two fold harnesses plus the `/data` harness: `Test Files 3 passed
(3)`, `Tests 48 passed (48)` (lock VERDICT command-exit 0).
- Ablation through `scripts/ablation-replace.mjs`, both fixes mutated
together (`objectViewHeaderChrome.tsx` anchor `!isEnvironmentList &&
(showCreate || primaryToolbarAction) ?` 1 → 0, replaced by
`!isEnvironmentList /* ablated */ ?`; `ObjectDataPage.tsx` anchor
`newButton && <>` 1 → 0, replaced by `(true as boolean) && <>`; both
restored, blob equal to HEAD, `git diff HEAD` empty): all four
no-primary pins red, both controls green, `Tests 4 failed | 37 passed
(41)`. With the assertions reordered to read the action first, the
list-page leg reads `AssertionError: expected [] to deeply equal [
'Launch Contract' ]` at 1110, 1184 and 700 px: the action was in the
`⋯`. ui vitest resolves `@object-ui/*` to `src/`, so no build sits
between mutation and run. A first `/data` leg replaced the anchor with
`<>`, which the tool refused (the replacement already occurred in the
file); it did not run.
- Every test file under `ui/packages/app-shell/src` and
`ui/apps/console/src` naming `PageHeader`, `ObjectDataPage`,
`ObjectView` or `objectViewHeaderChrome` (191 files, selected by `grep
-rlE`): `Test Files 191 passed (191)`, `Tests 2246 passed (2246)` (lock
VERDICT command-exit 0), at 1eba7d1; the final head adds only the
harness's module-top import, and the three pin files were re-run on it.
The rest of Test UI is CI's.
- `pnpm --filter @object-ui/app-shell type-check` (`tsc --noEmit` and
`tsc -p tsconfig.test.json`) after `turbo run build
--filter='@object-ui/app-shell^...'`: VERDICT command-exit 0.
- `pnpm exec eslint` on the five touched files from `ui/`: 0 errors (21
pre-existing warnings, none on added lines). `pnpm run
check:new-line-citations` (ui): `0 new citation(s)`.
</details>
## Acceptance notes
- **Real browser: NOT MEASURED** (no hotclm stack in this container).
The pins use the objectui#12705 harnesses' layout model; in it the base
code folds the card's list at 1110, 1184 and 700 px, matching the card's
1440 px reading.
- **Same class elsewhere:** `PackagesPage` always draws New Package, so
its folded face always keeps a labelled action; no change there.
- **hotclm (carrier: hotclm):** authoring `Launch Contract` as `variant:
'primary'` would also keep it labelled on a narrow header while the
other actions fold; not required for this fix.
## Verification
Gates from `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` on 2daa61d (change set: 6 paths vs merge
base bc6b7ff): **37 derived, 37 run, all exit 0**; `dispatch-gates
--ran`: "37 derived famil(ies) accounted for — 37 run, 0 NOT-MEASURED (a
DERIVED zero …)". Among them `check:test-source-alias`,
`check:type-check-debt`, `check:type-check-coverage`,
`check:cross-package-test-inputs`, `check:published-files`,
`check:nul-bytes`, `check-sdui-manifest` (and `--self-test`),
`check-changeset-no-major --base origin/main`, `check-empty-changeset
--base origin/main`, `check-adr-0087-registration --base origin/main`,
`pnpm --dir ui exec vitest run scripts/`. The first round on 1eba7d1
had `check:test-source-alias` red (the edited fold harness lacked the
module-top lint import); fixed in 2daa61d and the whole list re-run
there. Dogfood: n/a (no `!` in the title, no `(narrowing)` arm).
Changeset: `.changeset/33988-header-fold-needs-primary.md`,
`@object-ui/app-shell` and `@object-ui/console` patch.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmRPuiKPqavVVdijcAp)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 39fa82b commit 27c2f1e
6 files changed
Lines changed: 101 additions & 5 deletions
File tree
- .changeset
- ui/packages/app-shell/src
- layout
- views
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | | - | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
373 | 376 | | |
374 | 377 | | |
375 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
633 | 635 | | |
634 | | - | |
| 636 | + | |
635 | 637 | | |
636 | 638 | | |
637 | 639 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| |||
282 | 285 | | |
283 | 286 | | |
284 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
285 | 329 | | |
286 | 330 | | |
287 | 331 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | | - | |
| 142 | + | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
| |||
0 commit comments