Skip to content

fix(ui): the page designer canvas draws an authored record:details select and location the way the record page does - #27253

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-lb5wk5
Oct 28, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-lb5wk5

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread
Fixes #27177

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:Studio 页面设计器的 Design 画布上,作者写明字段名的 record:details 现在把 select 显示成选项标签、把 location 显示成坐标,不再是原始值 amer 和 [Object],与运行时记录页一致。
  • 为什么改:画布挂的就是运行时的 record:details,但 Studio 不给 dataSource,DetailView 只能从 dataSource 拿对象定义,于是只写字段名的条目没有类型,画成原始值;对象定义其实已在画布的记录上下文里。
  • 风险与回滚:只在 recordFromHost 且 dataSource 尚未答复时借用上下文里的对象定义;有 dataSource 时它的答复照旧优先,不新增任何请求,没有上下文或不走 recordFromHost 的 DetailView 输出不变(测试钉住);回滚即 revert 本 PR。
  • 先看:ui/packages/plugin-detail/src/DetailView.tsx(hostObjectSchema 那三行)、ui/packages/app-shell/src/views/metadata-admin/previews/PagePreview.authoredDetailsValues-27177.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/previews/PagePreview.authoredDetailsValues-27177.test.tsx packages/plugin-detail/src/__tests__/DetailView.hostObjectSchema-27177.test.tsx,预期 5 个测试全绿。
  • 需要你做的:无,席位落地。

What changes

  1. DetailView takes field types from the host's object schema when the host supplies the record. DetailView learned field types only from dataSource.getObjectSchema. Under recordFromHost (which record:details sets) it now reads the record context's objectSchema as well, and uses it until a dataSource answer arrives: objectSchema = dataSourceObjectSchema ?? (recordFromHost ? hostObjectSchema ?? null : null). A dataSource answer still wins, nothing new is fetched, no prop is added, and a DetailView with no record context, or one that reads its own record, draws as before.
  2. Changeset: .changeset/27177-detail-host-object-schema.md, patch for @object-ui/plugin-detail.

Why

The card's premise holds: on the Design canvas a full record page whose record:details names its fields drew a select as its stored code and a location as [Object]. The dispatch order assumed a canvas-side value-render site under views/metadata-admin/previews/; measuring disproved that. PagePreview wraps PageBlockCanvas in RecordContextProvider with the bound object's /meta schema and no dataSource (as every Studio preview does), and the canvas mounts the runtime record:details renderer itself, so the triage ruling ("the canvas reuses the runtime's field renderers; it does not get its own formatter") was already true. What the canvas lacked was the field metadata: the full-create seed writes sections[].fields as bare names, a bare-name entry carries no type, and DetailSection resolves the type from objectSchema, which stayed null without a dataSource. The slotted default looked right because its synthesized sections carry typed field objects; the record page looked right because it has a dataSource. The seat ruled the route on the card (order amendment 6468231446): fix it in DetailView, no new prop, no stub dataSource.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (packages/spec not touched.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (ESLint on the three changed source and test files: 0 errors; the repo-wide run is CI's).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 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 维护者速读 section, which the dispatch order requires in Chinese.
  • The Before Submitting list in CONTRIBUTING.md is done.

Tests

  • ui/packages/app-shell/src/views/metadata-admin/previews/PagePreview.authoredDetailsValues-27177.test.tsx (2): the full-create seed names its detail fields by bare name (premise pin); on the real Design canvas (real PageBlockCanvas, record context, record:details, DetailView and cell renderers; only the two endpoints PagePreview reads are doubled) the bound record:details body draws Americas for sales_region: 'amer' and 37.7749, -122.4194 for a location, never amer or [Object]; CONTROL inside it: a plain text field reads as stored.
  • ui/packages/plugin-detail/src/__tests__/DetailView.hostObjectSchema-27177.test.tsx (3): with no dataSource, a recordFromHost view under a record context draws the option label and the coordinates; CONTROL: with a dataSource, its answer wins over the host schema and is read once (no record read); CONTROL: with no record context, or without recordFromHost, the view draws the raw value exactly as before.

Acceptance notes

  • The fix lives in @object-ui/plugin-detail, outside the order's original file surface; the seat widened the surface to DetailView.tsx plus the changeset before the first edit (order amendment 6468231446).
  • The controls pin that a DetailView with no context still draws a bare-name select raw. That is the behaviour of a host that hands no object schema at all, unchanged on purpose.

Verification

All readings on head d8123be0 (branch tip after merging origin/main) unless noted.

New tests and wider suites
  • New files: 2 files, 5 tests, all pass.
  • pnpm --dir ui exec vitest run packages/plugin-detail/ under the verify lock: Test Files 325 passed, 1 skipped (326); Tests 2971 passed, 18 skipped; VERDICT command-exit 0.
  • pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/previews/ under the verify lock: Test Files 150 passed (150); Tests 1683 passed (1683); VERDICT command-exit 0.
  • Type check: pnpm --filter @object-ui/plugin-detail type-check and pnpm --filter @object-ui/app-shell type-check each exit 0 (after the closure build --filter '@object-ui/app-shell^...', VERDICT command-exit 0, and a @object-ui/plugin-detail rebuild after the merge).
  • ESLint on the three changed files: 0 errors (warnings are the files' existing any lines and the test doubles' as any, as in the sibling tests).
  • pnpm --dir ui run check:new-line-citations: 0 new citations.
Ablation (restored, blob equal to HEAD, git diff HEAD empty)

Run with node scripts/ablation-replace.mjs on the committed fix; the anchor hit once and the mutation landed on disk (blob b9030ab7 to 2d33b607). Both test files resolve @object-ui/plugin-detail and @object-ui/react to source through the vitest alias, so no dist leg.

  • const objectSchema = dataSourceObjectSchema ?? (recordFromHost ? hostObjectSchema ?? null : null); replaced by const objectSchema = dataSourceObjectSchema; turns 2 tests red (the canvas test, the no-dataSource DetailView test); the premise pin and both controls stay green.
Gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derives 34 families on this change set. Each ran on d8123be0 with its exit code captured before any pipe: 34 of 34 exit 0. dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED. dispatch-gates --tier: no path-derived mandate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbYUSW5btC4i3GbWXGe

…ma when no dataSource answers

The page designer canvas mounts the runtime record:details under a record
context that holds the bound object's schema but no dataSource, so DetailView
never learned the field types: an authored bare-name section drew a select's
stored code and a location as [Object]. Under recordFromHost the host's schema
now stands in until a dataSource answers; nothing new is fetched.

Claude-Session: https://claude.ai/code/session_01JQwxbYUSW5btC4i3GbWXGe
Co-authored-by: Claude <noreply@anthropic.com>
…nd in DetailView

Adds the canvas test (full-create seed, real record:details), the DetailView
controls (a dataSource answer wins; no context or no recordFromHost is
unchanged) and the plugin-detail patch changeset.

Claude-Session: https://claude.ai/code/session_01JQwxbYUSW5btC4i3GbWXGe
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling labels Oct 28, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · seat domain:ui#1 · session_01JQwxbZeBv2y91towxasSUT · head d8123be0 · 2026-10-28T13:12Z

席位意见:页面设计器画布上,record:details 块里的 select 现在显示选项名(Americas),location 显示地址,不再是 amer 或 [Object]。画布复用的是运行时详情渲染,没有新写格式化代码,也不拉取数据。符合 #27177 的分诊裁定(「画布复用运行时字段渲染器」)和修正后的路线 A(6468231446)。

  1. Shape: Fixes #27177; 4 files, +298/−2: ui/packages/plugin-detail/src/DetailView.tsx +14/−2, two new test files (canvas test under previews/, 3 DetailView tests), changeset @object-ui/plugin-detail patch.
  2. Premise measured: DetailView took field types only from its dataSource's getObjectSchema. The canvas mounts record:details under a record context that holds the object schema but has no dataSource, so bare-name fields had no type and drew raw. The fix reads useRecordContext()?.objectSchema (called unconditionally, so the hook order is stable) and uses it only when recordFromHost is set and no dataSource answer exists; objectSchema = dataSourceObjectSchema ?? (recordFromHost ? hostObjectSchema ?? null : null). A dataSource answer still wins, nothing new is fetched, and a DetailView without a record context or reading its own record is unchanged.
  3. Gates / check-runs: PR check-runs on d8123be0: 44 success, 11 skipped, 0 failure; mergeable_state clean. Dev's local run: 34/34 derived gates exit 0; plugin-detail (325 files) and previews (150 files) suites green; both type-checks exit 0; the ablation (drop the host-schema fallback) turns both fix tests red, the two controls stay green.
  4. Accepted deviations: none. The fix sits in plugin-detail (route A as amended) rather than under previews/, as the amendment ruled. Seat trial merge with origin/main is clean.
  5. Out of scope: none reported. Skills-docs: none — renderer fallback only.
  6. Landing: not Tier H; the seat readies and arms auto-merge.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 28, 2026 13:13
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 28, 2026 13:13
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 1e8e529 Oct 28, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-lb5wk5 branch October 28, 2026 13:29
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/m tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Page designer canvas draws a location field as "[Object]" and a select value raw when an authored record:details names its fields

2 participants