Skip to content

fix(plugin-detail): empty related lists fold into one line; record:path terminal stages share the rail - #26414

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-25895-related-empty-path-terminal
Oct 27, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-25895-related-empty-path-terminal

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #25895

Clause-②: no
Metadata-protocol: none

维护者速读

改了什么:记录页「相关」页签里没有记录的相关列表不再各占一整行,而是在有记录的列表之后合成一行,列出它们的名字,每个保留「新建」;阶段条(record:path)上的终止阶段(已取消 / 客户未到、成交 / 失败)与其它阶段等宽分配,标签换行而不是挤成一格。
为什么改:HotCRM 客户页「客户 0 · 暂无相关记录」夹在有数据的列表之间;活动页的「× 已取消 客户未到」挤在右端一个窄格里(#25895 两张截图)。
风险与回滚:只改显示,不加不删任何元数据键;全空的栈、单个列表、带「添加」选择器或工具栏动作的列表保持原样;有新记录时折叠的列表自动回到原位。回滚 = revert 本 PR。
先看:ui/packages/plugin-detail/src/RelatedListEmptyFold.tsx(规则与折叠行)→ renderers/record-related-list.tsx(接入)→ renderers/record-path.tsx(等分宽度)。
两分钟验证:cd ui && pnpm exec vitest run packages/plugin-detail/src/renderers/__tests__/record-related-list.emptyFold-25895.test.tsx packages/plugin-detail/src/renderers/__tests__/record-path.terminalWidth-25895.test.tsx,预期 12 个测试全过。
需要你做的:无,绿了即可落地;新文案的语言包键是后续工作(见下文)。

What

Item 1 — empty related lists fold into one line. On a record's Related tab, the lists with zero records leave their place once every list of the stack has answered, and the last list of the stack draws one line after itself: the empty-state text, then each folded list's title with its own New (same handler, same createDisabled verdict). A folded list stays mounted (hidden), so when it gains a record it answers "not empty" and returns to its place. Unchanged by design: a stack whose lists are all empty, a list on its own, and an empty list that offers more than New (an add picker, child toolbar actions, an authoring notice) draw exactly as before.

Item 2 — terminal stages get legible width. On the desktop rail both stage groups now start from zero and grow by the number of stages they hold, and every stage fills its share, so a terminal stage is exactly as wide as any other. A terminal stage's label (the won terminus and the separated lost group) wraps instead of being truncated or held on one line. Ordinary forward stages keep their one truncated line; the mobile row (horizontal scroll) is unchanged.

Which seam, and why (item 1)

Who stacks the lists: buildDefaultTabs (synth/buildDefaultPageSchema.ts) only emits the Related tab's record:related_list children; page:tabs (PageTabsRenderer in @object-ui/components) draws them as plain siblings through renderChildren; RecordDetailView only hands related to the synthesizer. None of the three knows how many rows a list has — each list learns that from its own read — and an authored page can stack lists in any container.

So the seam is the block itself: record:related_list lists that share a DOM container coordinate through a small store keyed by that container (ui/packages/plugin-detail/src/RelatedListEmptyFold.tsx). RelatedList gains one optional callback, onEmptyChange(empty), reporting its settled answer (null while a read is in flight); the block keeps the last answer during a refetch so a write elsewhere does not unfold and refold the stack. This reaches synthesized and authored pages alike, adds no node type and no spec key, and leaves the synthesizer, app-shell and components untouched.

RelatedList.tsx and the new RelatedListEmptyFold.tsx are outside the claim's listed file surface (one optional prop plus one effect, and the new module); both sit in the same package beside the claimed files.

Strings and locale packs

No new translation key is introduced. The fold line reuses detail.noRelatedRecords and detail.new, both already in every pack; each folded entry is a role="group" named by the list's title, so each New is announced inside its list's name. A dedicated phrase such as 「其他 2 个为空:客户、线索」 needs a new key in the locale packs, which this PR does not touch (that line is busy); it is a follow-up once the i18n line drains. Note for that follow-up: check:i18n-keys refuses a t() key absent from the en pack and its baseline is empty, so an inline defaultValue alone would not pass CI — the key has to land in the packs.

Tests

  • ui/packages/plugin-detail/src/renderers/__tests__/record-related-list.emptyFold-25895.test.tsx (6 tests) and ui/packages/plugin-detail/src/renderers/__tests__/record-path.terminalWidth-25895.test.tsx (6 tests), committed red first (aba3b5ca).
  • Red leg, implementation files restored to the base f02e6443 in the tree (markers onEmptyChange / shareOf counted 0): 9 failed / 3 passed — the three that pass are CONTROL legs that hold before and after (all-empty stack, single list, ordinary forward stage). Restore proven by blob hashes equal to HEAD. Green leg: 12/12.
  • pnpm exec vitest run packages/plugin-detail --maxWorkers=2 (from ui/, at 5cf6e03e): 306 files passed, 1 failed — spec-symbol-batch7.test.ts names every props type in renderers/ that is not spelled …RendererProps; the fold module was moved out of renderers/ to src/ (beside EmptySectionsFold.tsx) in 47121545, and the post-merge run below covers that file.
  • Consumers of the changed rendering, run as a targeted set (not the full app-shell suite): 34 files that mention an empty related list or record:related_list under app-shell, apps/console and components, plus the RecordDetailView related-list files: 34/34 files, 293/293 tests.
  • pnpm --filter @object-ui/plugin-detail type-check: exit 0.
  • sdui.manifest.json: regenerated under the lock before the merge, byte-unchanged (106 components, sha256 1f6e1ccb925a…); no record is committed (the sources records were retired on main). node scripts/check-sdui-manifest.mjs: exit 0.

After merging origin/main (merge 8271adf9, which retired scripts/sdui-manifest.sources/; no plugin-detail or lockfile overlap), at head 8271adf9:

  • pnpm --filter @objectstack/spec build (main moved spec), then spec-symbol-batch7.test.ts plus every record-path*, record-related-list*, recordComponentAria* and RelatedList* test in plugin-detail: 59/59 files, 396/396 tests. pnpm --filter @object-ui/plugin-detail type-check: exit 0.
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 35 derived families, all run, each exit 0 (check-sdui-manifest.mjs among them); --ran reconciled 35/35 with exit codes recorded, 0 NOT-MEASURED.

Acceptance notes

  • A related list whose read FAILS shows today's empty state ("No related records found") because RelatedList only logs the error; with this change such a list is also folded as empty. That is unchanged behaviour of the read path, noted, not filed here.
  • The stack is the DOM container: lists an authored page wraps in separate containers never fold together, by design.
  • The terminal-stage share is equal up to the alt group's divider gap and padding.

Generated by Claude Code

…inal width (red)

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
…; terminal path stages share the rail

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
…nt exports; add changeset

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Oct 27, 2026
…wned name Member

Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

维护者速读

改了什么:记录页「相关」页签里没有记录的相关列表不再各占一整行,而是在有记录的列表之后合成一行,列出它们的名字,每个保留「新建」;阶段条(record:path)上的终止阶段(已取消 / 客户未到、成交 / 失败)与其它阶段等宽分配,标签换行而不是挤成一格。
为什么改:HotCRM 客户页「客户 0 · 暂无相关记录」夹在有数据的列表之间;活动页的「× 已取消 客户未到」挤在右端一个窄格里(#25895 两张截图)。
风险与回滚:只改显示,不加不删任何元数据键;全空的栈、单个列表、带「添加」选择器或工具栏动作的列表保持原样;有新记录时折叠的列表自动回到原位。回滚 = revert 本 PR。
先看:ui/packages/plugin-detail/src/RelatedListEmptyFold.tsx(折叠规则 decideEmptyFold 与按容器分组的 store)→ renderers/record-related-list.tsx(接入)→ renderers/record-path.tsx(等分宽度)。
两分钟验证:在 ui/ 下运行 pnpm exec vitest run packages/plugin-detail/src/renderers/__tests__/record-related-list.emptyFold-25895.test.tsx packages/plugin-detail/src/renderers/__tests__/record-path.terminalWidth-25895.test.tsx,预期 12 个测试全过。
需要你做的:无,席位落地。
席位意见:ACCEPT。读取失败的相关列表今天就显示成「暂无相关记录」,本 PR 后还会被折叠;这是既有缺陷,已另立 #26415(p3)。折叠行复用现有文案键,不新增语言包键。

席位核对

seat 2 · 2026-10-27T04:17Z · head 3fb46e57 (#25895)

item reading
form 7 files, +680/−11: new plugin-detail/src/RelatedListEmptyFold.tsx (stack store keyed by the blocks' DOM container, decideEmptyFold, fold line), record-related-list.tsx wiring, RelatedList.tsx one optional onEmptyChange prop + effect, record-path.tsx equal-share rail with wrapping terminal labels, two new pins, root .changeset/; no spec key, no record file
premise measured the claim's premise held; none of the synth (buildDefaultTabs), page:tabs or RecordDetailView knows row counts, so the seam is the block itself and covers authored pages too
gates (check-runs on head) 54 runs: 45 success, 9 skipped, 0 failed. Local: red 9/12 at base f02e6443 (3 controls green), green 12/12; post-merge targeted 59 files / 396 tests incl. spec-symbol-batch7; 34 consumer files / 293 tests (app-shell, console, components); plugin-detail type-check exit 0; 35 of 35 derived gates exit 0
accepted deviations (1) two files beyond the claim's list, both plugin-detail: RelatedList.tsx (one optional prop) and the new module (moved out of renderers/ for spec-symbol-batch7); (2) FAIL round 1: check:spec-symbols red at 8271adf9 on a private interface Member (a spec export name), renamed FoldStackEntry, no waiver; (3) no new strings: check-i18n-call-site-keys refuses a key missing from en, so the fold line reuses detail.noRelatedRecords and detail.new
out of scope a failed related read shows as empty (pre-existing; folds after this PR) → #26415; a dedicated count phrase (「其他 N 个为空」) is not owed: the reused keys read correctly
landing NOT governed (check-governed-merges --pr 26414: 691 lines, no hit path); git merge-tree against origin/main clean; no other open PR touches these files; #26329 (DetailSection.tsx) is unrelated

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/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants