This repository was archived by the owner on Oct 26, 2026. It is now read-only.
Repository navigation
Commit 263e9dd
fix(plugin-detail): a detail section on a print page prints every declared field and no "Show N empty fields" button (#12729)
Fixes #12717
Clause-②: no
## What
On a page that declares `print`, a `record:details` section prints every
field it declares. The "Show N empty fields" / "Hide empty fields"
button no longer reaches paper.
`packages/plugin-detail/src/DetailSection.tsx` hides empty fields for
two reasons, and they belong to two different owners.
- `shouldAutoHideEmpty` is the renderer's own density heuristic. No
author declares it, and it depends on the viewport (`useIsMobile`) and
on a ratio of empty fields, so it is a screen concern. On a print page
it is now off. Every declared field prints, an empty one as the shared
placeholder dash. The toggle is derived from the heuristic
(`showEmptyToggle = emptyCount > 0 && shouldAutoHideEmpty`), so with no
auto-hide there is no toggle. This follows card ②'s rule
(objectui#11958): `record:details` is in the printable block subset
because it prints every field it declares. That is the same reason the
collapsed section already opens on paper.
- `hideAllEmptySection` (`section.hideEmpty === true`) is the authored
`record:details` key. On paper it keeps doing what it declares: an
all-empty section prints nothing at all, with no heading and no control.
It is not gated.
`usePrintPage()` is now read once, above every early return
(`isPrintPage`). The existing collapse gate and the new heuristic gate
both read that one value.
Not done, deliberately:
- No `print:hidden` on the button. The empty fields would still be
missing from the paper.
- No change to `page-print.ts`.
- The gate stays local to the heuristic, so objectui#12618 (the
on-screen all-empty fold, on hold) can change that fold and keep this
gate.
Off a print page, the toggle, the heuristic and the authored hide are
unchanged.
## Tests
`packages/plugin-detail/src/__tests__/detailSectionPrintEmptyToggle-12717.test.tsx`,
all at head 9f28cd2:
1. Inside a `PrintPageProvider`: no toggle, all four declared fields
present, two placeholders.
2. Inside a `PrintPageProvider`: an authored `hideEmpty: true` all-empty
section renders nothing.
3. Control, off a print page: the toggle reads "Show 2 empty fields" and
the empty rows are hidden.
Each test was proven red by a one-off ablation, then restored. Each
restore was checked: blob 576f471 equals HEAD and `git diff HEAD`
is empty.
- Deleting the print gate turns test 1 red.
- Gating the authored hide on print (the wrong fix) turns test 2 red.
- Turning the heuristic off everywhere turns test 3 red.
`pnpm exec vitest run packages/plugin-detail` at 9f28cd2: 275 files
passed, 1 skipped; 2663 tests passed, 14 skipped.
## Local gates (9f28cd2)
All of these exited 0:
- the closure build for `@object-ui/plugin-detail`;
- the `@object-ui/plugin-detail` build and type-check;
- the console build with `VITE_BASE_PATH=/console/`;
- `check:changeset-claims`, `changeset:check`, `check:test-path-roots`,
`check:spec-symbols` and the changeset presence check.
eslint on the changed files reports 0 errors. Its 12 warnings were all
in `DetailSection.tsx` already; the base file has the same 12.
## Acceptance notes
- NOT MEASURED: PDF reading. The showcase invoice print page
`showcase_invoice_document` is not in the published showcase at
`@objectstack/cli@18.0.0-next.2`, nor in objectstack `main` 6d1660d. As
a fallback, I added a throwaway page-level `print` to a showcase record
page in a scratch copy of the backend. It never reached the served page
metadata, and no print page mounted on the record route, so no
before/after PDF could be rendered.
- Other controls in this file on paper:
- A collapsible section's disclosure chevron still prints, inside the
header button that card ② opens. It is outside this claim's file
surface, so it is reported, not fixed.
- The hover copy and pencil buttons are invisible until hover, so they
draw nothing on paper.
Provenance: built by the cloud session
`session_01D7HiWiz4iSX26uyJLB8jNs` (claim `6218362787`) and opened by
the `domain:ui` seat 1 PM (`session_011K9g23W67dy2zwnyzaoB6o`) from that
session's final message, because a cloud session cannot open a PR from
its container. The seat replaced the dev's own footer lines with this
line.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01D7HiWiz4iSX26uyJLB8jNs)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent c41ce3f commit 263e9dd
3 files changed
Lines changed: 114 additions & 2 deletions
File tree
- .changeset
- packages/plugin-detail/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
301 | 313 | | |
302 | 314 | | |
303 | 315 | | |
304 | 316 | | |
305 | 317 | | |
| 318 | + | |
306 | 319 | | |
307 | 320 | | |
308 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
0 commit comments