Repository navigation
Commit 2df9691
fix(plugin-detail): an authored record page folds its all-empty field groups into one closing line (#35161)
Fixes #35019
repo:objectstack#1 · os-warren · session_01JQwxbXBffgVtUPBEY2nLFm
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:自建记录页(如 HotCRM 商机页)的「明细」里,字段全空的分组不再各占一张带边框的卡,而是折进明细末尾的一行「商机叙述 ·
备注与下一步 · 2 个空分区 · 展开」,与默认记录页同一个设计;点「展开」后两组回到原位,各自是一张卡(标题加一行「显示 N
个空字段」),从那一行可显示并就地编辑字段。
- 为什么改:新建商机时这两张空卡各占约 80px,看起来像有内容,其实什么都没有;默认记录页早已折成一行,自建页没有跟上。
- 风险与回滚:只改 `record:details` 明细体的只读展示;有内容的分组(含其「显示 N 个空字段」)、编辑态、打印页、独立的
`detail-view` 都不变。回滚即 revert 本 PR,无数据或元数据迁移。
-
先看:`ui/packages/plugin-detail/src/DetailView.tsx`(决定哪些明细体画这一行的判断)、`ui/packages/plugin-detail/src/renderers/record-details.tsx`(`record:details`
打开该判断的包裹)、`packages/spec/src/ui/component.zod.ts`(`hideEmpty` 的 describe
改写)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/plugin-detail/src/__tests__/EmptySectionsLine.authoredPage-35019.test.tsx`,预期
10 个测试全部通过。
- 需要你做的:无,席位落地。
## What changes
On an authored record page, a `record:details` body drew every group the
page keeps with `hideEmpty: false` as its own bordered card even when
all its fields were empty: a card holding a heading and one "Show N
empty fields" row. The synthesized default page already folds such
groups into one closing line (`EmptySectionsLine`, objectstack#27055
Target 2), but `DetailView` drew that line only under
`DefaultRecordPageContext`, so an authored page fell to the whole-body
fold, which folds only when every group is empty. Scope as corrected on
the card (comment 6970082809): draw the same line on authored
`record:details` pages, no new design, no new metadata key.
- **The switch.** `RecordDetailsRenderer` now wraps the `DetailView` it
mounts in a new module-internal `EmptySectionsLineContext` (in
`defaultRecordPage.ts`, beside the other record-page face contexts; not
re-exported from the barrel, not a prop, not a schema key, the
`RecordPageProvenanceContext` precedent). `DetailView` draws
`EmptySectionsLine` when that context or `useDefaultRecordPage()` is on
and the body has no `sectionGroups`. Every other body keeps
`EmptySectionsFold` unchanged.
- **Paths an authored `record:details` reaches, and which this covers.**
`record:details` always hands `DetailView` a schema with `sections` (or
the direct-`fields` fallback), never `autoTabs`, `tabs` or
`sectionGroups`, so it always reaches the non-tab sections block, which
is the branch this changes. The HotCRM opportunity page's `{ group }`
references are resolved to `sections` with `fields` by the renderer, so
they arrive as `sections`. Not changed: the `autoTabs` body and
`sectionGroups` bodies (reached only by a `detail-view` node), and the
direct-`fields` fallback (one section, no fold either way). A bound
`record:details` (per-element `dataSource`) draws the line too; measured
producers of a bound `record:details` in HotCRM and the showcase/CRM
examples: 0.
- **The whole-body fold.** On a `record:details` body it is subsumed by
the line: a body whose every kept group is empty now draws the line
naming them all, where it drew one unnamed "Show N empty fields" row
(pinned). Everywhere else it keeps working as before (CONTROL pin, and
the objectui#13386 suite, unchanged and green).
- **Kept as is.** A group with a value draws as before, its own "Show N
empty fields" row included. Edit mode and a print page draw every group.
`hideEmpty` keeps its default, and a group the default hides is never
named in the line.
- **Contract prose the change would make false, restated (ruling
6970082809; ruling C on objectui#13386 is kept as the expanded face).**
The `describe()` of `RecordDetailsProps.sections[].hideEmpty` in
`@objectstack/spec` said a kept all-empty section renders, read-only, as
its heading plus one fold row. On `record:details`, its only renderer,
it is now named in the closing line first. Restated there and in its
mirrors: the `@object-ui/types` docs (`RecordDetailsProps` section,
`DetailViewSection.hideEmpty`), the `record:details` `sections` input
description in the component registry, the plugin README. Regenerated,
not hand-edited: `content/docs/references/ui/component.mdx`
(`check:generated --fix`), `sdui.manifest.json` with
`scripts/sdui-manifest.record.json` (`node
scripts/gen-sdui-manifest-node.mjs`),
`content/docs/ui/components/record.mdx` (`node
scripts/gen-sdui-reference.mjs`).
- **Two stale pins, updated.**
`record-details.emptySectionDefault.test.tsx` and
`record-details.hideEmptyRetired-7129.test.tsx` each pinned a kept
all-empty section drawing its heading first through `record:details`,
the exact face this changes. Both now assert the line names it, expand
the line, and then assert the same heading plus fold row as before.
## Tests
- New:
`ui/packages/plugin-detail/src/__tests__/EmptySectionsLine.authoredPage-35019.test.tsx`,
10 tests, through the real `RecordDetailsRenderer` with no
`DefaultRecordPageContext` (the HotCRM opportunity's groups as the
fixture):
- two all-empty kept groups beside two filled ones: one line, count 2,
naming both, after every drawn group; only the two filled groups draw a
card;
- the partly-filled group keeps its own "Show 5 empty fields" row,
before and after expanding;
- expanding draws all four groups in their authored order, each empty
one as its heading plus its own fold row; collapsing folds them back;
- revealing a group's empty fields and double-clicking one enters inline
edit, and edit mode draws every group with inputs (no line);
- every group empty: the line names them all and no whole-body row is
drawn;
- a group hidden by the `hideEmpty` default is not named;
- a print page draws every group, no line;
- CONTROL, a standalone `DetailView`: a card per empty group with its
fold row, and the whole-body fold when all are empty.
- Ablation (one-off, on commit `61c05ae8`): `DetailView` mutated back to
the old gate (`return onDefaultRecordPage && …` in place of `return
emptySectionsAsLine && …`) through `scripts/ablation-replace.mjs` with a
trap restore: anchor x1 to x0, replacement x0 to x1, blob `03ed8fb5` to
`2022a062`; the new file went **7 failed, 3 passed** (the 3 are the
print-page case and the two CONTROL cases, which hold either way);
restore proven by blob equal to HEAD `03ed8fb5` and an empty `git diff
HEAD`. No `dist/` is in the resolution path (the tests import the
sources relatively), so no rebuild leg applies.
- Red set before the pin updates (on `a0d385a9`, the switch alone):
plugin-detail 2 failed files, 383 passed; the two failures are the two
pins named above.
- Final head `429ee81c`, results under Verification.
## Acceptance notes
- **The default page draws this line only for groups a page keeps.** The
synthesized default page writes `{ group }` sections with no
`hideEmpty`, so `record:details` resolves them to `true` and an
all-empty group is hidden outright there; the line has nothing to fold
on a synthesized page. It draws where a page keeps a group with
`hideEmpty: false`, as the HotCRM opportunity page does. Unchanged by
this PR; an observation.
- **After expanding, the fields are one more click away**: each empty
group draws its heading plus its own "Show N empty fields" row (ruling C
on objectui#13386), which is the shipped default-page design ("no new
design"). The card's acceptance item "展开后能看到全部空字段,并能就地编辑" holds through
that row, and the reader's show-empty choice is per object where the
host stores it.
- **Beyond the claim's file surface** (DetailView.tsx,
EmptySectionsFold.tsx, new tests, `.changeset/`):
`renderers/record-details.tsx` (the context provider),
`defaultRecordPage.ts` (the context, beside its siblings), the two stale
pins, and the contract prose and generated mirrors listed above, which
the change would otherwise have left false.
- A code comment in app-shell's `RecordDetailView` still lists "the
empty-sections line" among the faces only the synthesized page draws;
not edited here (another package, comment only).
`recordPageV3Face-27055.test.tsx`'s CONTROL is named "outside the
default page no line draws"; it renders a bare `DetailView`, which still
draws none, so it stays green.
- Not browser-verified; the pins drive the real `record:details`
renderer.
## Verification
All readings on head `429ee81c` (after merging `origin/main` at
`aef42cba`).
<details>
<summary>Tests and type-checks · one verify-lock run · VERDICT
command-exit 0</summary>
```text
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-detail/
Test Files 386 passed | 1 skipped (387)
Tests 3470 passed | 18 skipped (3488)
pnpm --dir ui exec vitest run scripts/
Test Files 171 passed | 2 skipped (173)
Tests 5092 passed | 2 skipped (5094)
pnpm --filter @objectstack/spec exec vitest run src/ui/component.test.ts src/ui/section-group-reference.test.ts src/ui/component-reference-rail.test.ts src/type-alias-convention.pin.test.ts
Test Files 4 passed (4)
Tests 417 passed (417)
pnpm --filter @object-ui/plugin-detail run type-check (tsconfig.test.json lists all 3 touched test files)
pnpm --filter @object-ui/types run type-check
os-verify-lock: VERDICT command-exit 0 (the five joined with &&)
```
</details>
<details>
<summary>Derived gate families · 123 derived, 123 run, 0 NOT
MEASURED</summary>
`node scripts/pm/dispatch-gates.mjs --commands` on this head, each run
with its exit code captured before any pipe, then reconciled with
`--ran`: "123 derived famil(ies) accounted for — 123 run, 0 NOT-MEASURED
(a DERIVED zero — all 123 recorded an exit code and none of them is 3)".
```text
exit 0 · node scripts/check-adr-0087-registration.mjs --base origin/main
exit 0 · node scripts/check-adr-0087-registration.mjs --self-test
exit 0 · node scripts/check-adr-links.mjs
exit 0 · node scripts/check-adr-links.mjs --self-test
exit 0 · node scripts/check-changeset-no-major.mjs --base origin/main
exit 0 · node scripts/check-closing-keyword-parity.mjs
exit 0 · node scripts/check-closing-keyword-parity.mjs --self-test
exit 0 · node scripts/check-comment-mask-adoption.mjs
exit 0 · node scripts/check-comment-mask-adoption.mjs --self-test
exit 0 · node scripts/check-comment-mask-corpus.mjs
exit 0 · node scripts/check-dev-prereqs.mjs --self-test
exit 0 · node scripts/check-doc-route-spelling.mjs --advisory
exit 0 · node scripts/check-doc-route-spelling.mjs --self-test
exit 0 · node scripts/check-docs-section-name.mjs
exit 0 · node scripts/check-docs-section-name.mjs --self-test
exit 0 · node scripts/check-dts-emitted.mjs --self-test
exit 0 · node scripts/check-empty-changeset.mjs --base origin/main
exit 0 · node scripts/check-empty-changeset.mjs --self-test
exit 0 · node scripts/check-issue-citations.mjs
exit 0 · node scripts/check-plugin-teardown-shape.mjs
exit 0 · node scripts/check-plugin-teardown-shape.mjs --self-test
exit 0 · node scripts/check-sdui-manifest.mjs
exit 0 · node scripts/check-sdui-manifest.mjs --self-test
exit 0 · node scripts/check-section-landing-index.mjs
exit 0 · node scripts/check-section-landing-index.mjs --self-test
exit 0 · node scripts/ci/assert-turbo-remote-cache.mjs --self-test
exit 0 · node scripts/ci/plan-test-core-shards.mjs --self-test
exit 0 · node scripts/ci/prune-turbo-cache.mjs --self-test
exit 0 · node scripts/ci/snapshot-next.mjs --self-test
exit 0 · node scripts/docs-audit/check-affected-docs.mjs
exit 0 · node scripts/docs-audit/check-drift-comment.mjs
exit 0 · node scripts/pm/check-governed-queue-guard.mjs --self-test
exit 0 · node scripts/pm/release-rehearsal-clone.mjs --self-test
exit 0 · node scripts/release-pending-publish.mjs --self-test
exit 0 · pnpm --filter @objectstack/lint run check:doc-formula-expressions
exit 0 · pnpm --filter @objectstack/lint run check:doc-security-posture
exit 0 · pnpm --filter @objectstack/spec run check:api-surface
exit 0 · pnpm --filter @objectstack/spec run check:authorable-surface
exit 0 · pnpm --filter @objectstack/spec run check:browser-reachable-entries
exit 0 · pnpm --filter @objectstack/spec run check:docs
exit 0 · pnpm --filter @objectstack/spec run check:dual-source-exports
exit 0 · pnpm --filter @objectstack/spec run check:duration-unit-keys
exit 0 · pnpm --filter @objectstack/spec run check:empty-state
exit 0 · pnpm --filter @objectstack/spec run check:entry-nameability
exit 0 · pnpm --filter @objectstack/spec run check:error-code-provenance
exit 0 · pnpm --filter @objectstack/spec run check:export-origins
exit 0 · pnpm --filter @objectstack/spec run check:exported-any
exit 0 · pnpm --filter @objectstack/spec run check:generated
exit 0 · pnpm --filter @objectstack/spec run check:liveness
exit 0 · pnpm --filter @objectstack/spec run check:llms-txt
exit 0 · pnpm --filter @objectstack/spec run check:skill-examples
exit 0 · pnpm --filter @objectstack/spec run check:skill-refs
exit 0 · pnpm --filter @objectstack/spec run check:strictness-ledger
exit 0 · pnpm --filter @objectstack/spec run check:variant-docs
exit 0 · pnpm --filter @objectstack/spec run check:yaml-examples
exit 0 · pnpm check:adr-anchors
exit 0 · pnpm check:agent-test-spelling
exit 0 · pnpm check:authz-resolver
exit 0 · pnpm check:bash32-floor
exit 0 · pnpm check:changeset-gate-self-tests
exit 0 · pnpm check:ci-filter-parity
exit 0 · pnpm check:cli-command-ids
exit 0 · pnpm check:closed-ceremony-text
exit 0 · pnpm check:corpus-claim-drift
exit 0 · pnpm check:cross-package-test-inputs
exit 0 · pnpm check:dispatcher-error-vocabulary
exit 0 · pnpm check:doc-anchors
exit 0 · pnpm check:doc-authoring
exit 0 · pnpm check:doc-frontmatter
exit 0 · pnpm check:docs-audit-scope
exit 0 · pnpm check:docs-redirects
exit 0 · pnpm check:docs-single-h1
exit 0 · pnpm check:docs-spec-enumerations
exit 0 · pnpm check:docs-transcript-drift
exit 0 · pnpm check:driver-memory-census
exit 0 · pnpm check:dts-closure
exit 0 · pnpm check:dual-build-cjs-loads
exit 0 · pnpm check:engine-double-contract
exit 0 · pnpm check:entry-guard
exit 0 · pnpm check:gitlink-declared
exit 0 · pnpm check:issue-citations
exit 0 · pnpm check:keyed-text-bounds
exit 0 · pnpm check:lean-entry-closure
exit 0 · pnpm check:logger-receiver-detach
exit 0 · pnpm check:merge-driver
exit 0 · pnpm check:nul-bytes
exit 0 · pnpm check:object-def-param-keys
exit 0 · pnpm check:optional-error-sink
exit 0 · pnpm check:org-identifier
exit 0 · pnpm check:page-declaration-shape
exit 0 · pnpm check:parse-guard
exit 0 · pnpm check:platform-object-tenancy-census
exit 0 · pnpm check:pm-prior-rulings
exit 0 · pnpm check:pnpm-filter-targets
exit 0 · pnpm check:pnpm-flag-spellings
exit 0 · pnpm check:published-files
exit 0 · pnpm check:published-readme-links
exit 0 · pnpm check:query-options-erasure
exit 0 · pnpm check:react-page-adapter-contract
exit 0 · pnpm check:refd-timer-probe
exit 0 · pnpm check:registry-log-declared
exit 0 · pnpm check:rest-log-spy-declared
exit 0 · pnpm check:role-word
exit 0 · pnpm check:scripts-symbol-anchors
exit 0 · pnpm check:sdui-reference
exit 0 · pnpm check:settings-bind-window
exit 0 · pnpm check:skill-identifier-liveness
exit 0 · pnpm check:slot-lookup
exit 0 · pnpm check:sourcemap-no-sources-content
exit 0 · pnpm check:spec-docblock-symbol-anchors
exit 0 · pnpm check:spec-parsed-alias
exit 0 · pnpm check:system-context-census
exit 0 · pnpm check:test-source-alias
exit 0 · pnpm check:tier-file-adoption
exit 0 · pnpm check:type-check-coverage
exit 0 · pnpm check:type-check-debt
exit 0 · pnpm check:undeclared-dep-imports
exit 0 · pnpm check:vendor-version-stamps
exit 0 · pnpm check:vouch-for-reference-callers
exit 0 · pnpm check:watch-hint-literal
exit 0 · pnpm check:where-matcher
exit 0 · pnpm check:wildcard-fallthrough
exit 0 · pnpm --dir ui exec vitest run scripts/ (under the verify lock, chained below)
```
</details>
<details>
<summary>Generated artifacts, overlap, line citations</summary>
```text
pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec check:generated (after the merge of origin/main)
All 14 generated artifacts are up to date
node scripts/gen-sdui-manifest-node.mjs
wrote sdui.manifest.json (106 components), re-recorded scripts/sdui-manifest.record.json
node scripts/gen-sdui-reference.mjs
wrote 106 components on 7 pages
node scripts/pm/overlap-check.mjs
VERDICT clean exit 0 (origin/main merges cleanly, 0 open PR heads share a file)
pnpm --dir ui run check:new-line-citations
VERDICT new-cross-file-line-citations: 0 new citation(s)
eslint on the 10 touched ui files: 0 errors (warnings are pre-existing; the new context lives in a non-component module, so no new react-refresh warning)
```
</details>
Not run locally, CI's: the repo-wide `pnpm lint`, `test:repo`, and the
full UI and Core test farms. Local-only family `check:dev-prereqs`:
self-test passes; its scan reports this container's workspace as not
fully built (10 of 108 packages without `dist/`), a reading about this
machine, not the diff.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic
(one `describe()` text and its doc comment).
- [x] 2. Every name I added uses the casing for its kind.
- [ ] 3. No formatter ran; the repo-wide `pnpm lint` is CI's (eslint on
the touched `ui/` files: 0 errors).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [ ] 8. Title, body and comments are in English, except the 维护者速读
block, which the dispatch contract writes in Chinese.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 55020c3 commit 2df9691
17 files changed
Lines changed: 414 additions & 42 deletions
File tree
- .changeset
- content/docs
- references/ui
- ui/components
- packages/spec/src/ui
- scripts
- ui/packages
- plugin-detail
- src
- __tests__
- renderers
- __tests__
- types/src
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1765 | 1765 | | |
1766 | 1766 | | |
1767 | 1767 | | |
1768 | | - | |
| 1768 | + | |
1769 | 1769 | | |
1770 | 1770 | | |
1771 | 1771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1412 | 1412 | | |
1413 | 1413 | | |
1414 | 1414 | | |
1415 | | - | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
1416 | 1419 | | |
1417 | 1420 | | |
1418 | 1421 | | |
1419 | 1422 | | |
1420 | | - | |
| 1423 | + | |
1421 | 1424 | | |
1422 | 1425 | | |
1423 | 1426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
0 commit comments