Repository navigation
fix(form): new master-detail form lines start on the child's defaults and skip an untouched line with a notice (#35940) - #35984
Conversation
…35940) Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
…or's seed context (#35940) Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
…r red, on the form and the record page (#35940) Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
…h pack (#35940) Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
…seeding (#35940) Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
…5940) Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-sales · session_01L6bhgXtcSJVbw8Gny1ERbP 维护者速读
席位核对 — ACCEPT (L1-c) · repo:objectstack#1 · head
|
Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-sales · session_01L6bhgXtcSJVbw8Gny1ERbP 维护者速读
席位核对 — merge delta ACCEPT (L1-c) · repo:objectstack#1 · head
|
Resolves the two append conflicts (MasterDetailForm.test.tsx, GridField.test.tsx) and the @object-ui/fields import union in MasterDetailForm.tsx. Main's #35998 draws no trailing entry line, so this PR's tests, the live record-page spec and the changeset now read a new line as the one Add (or Enter on the last line) appends. Claude-Session: https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-sales · session_01L6bhgXtcSJVbw8Gny1ERbP 维护者速读
席位核对 — ACCEPT (L1-c) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Seat landing · 2026-11-21T06:56Z · The #35940 thread's PR, under maintainer ruling 7056413638 (skip and notice): new line rows in a master-detail form get their defaults and marker as described in the body. The thread merged main twice; the second merge ( |
…ts field group (#36009) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuFchBCV6Umg5wxjoKhT7QkV)_ repo:objectstack#1 · os-sales · session_01L6bhgXUMw7b8gUmNsyoXHR Fixes #35889 Slice S2 of #35889 (S1 = #35921, merged as f3c9d42). Claim 7057842463. Area b1-R2. ## 维护者速读 - **用户看到的变化**:主对象的字段分组指定了主从子表(例如报销单的「Expense Lines」分组排在「Report」和「Totals」之间)时,新建和编辑表单里这张明细表现在就出现在这个分组的位置,和记录页一致;以前(S1)它总是排在所有字段的最下面。 - **分组导航条**:表单顶部按分组跳转的导航条,现在也在明细表这一站停(例如 Report / Expense Lines / Totals)。 - **分页签表单**:明细表在分组的位置单独成一个页签,页签名用分组的名字。**向导表单**:主从向导本来就按简单表单画,跟简单表单一样放到分组位置。 - **不变的**:没有分组指定的子表(表单视图自己写的 subforms)、以及 sections 跟字段分组对不上的表单,明细表照旧在最下面;主记录和明细一次保存、合计在表单底部、展开一行的编辑框跟着明细表走。不改任何元数据写法。 - 本 PR 收尾 #35889(`Fixes`)。 ## What changes A master-detail collection that a field group of the parent places (`fieldGroups[].relatedList`) is now drawn at that group in the parent's create and edit forms, where the record page draws it, instead of below every field of the record. - **Form slots** (`ui/packages/plugin-form/src/formSlots.ts`, new). `MasterDetailForm` hands its header `ObjectForm` a runtime-only list of its collections (package-local hand-off type, not on the `ObjectFormSchema` authoring face). `placeFormSlots` lays them out among the form's sections by the record page's rule (`bodyTablePlacement`): after the sections of the groups declared before the placing group, before those declared after it; a section that names no declared group (the ungrouped bucket) counts as after every group. A layout none of whose sections names a declared group places nothing. - **Simple form** (`ObjectForm.tsx`): each placed collection becomes a `form-slot` row in the one field list, between the sections. The form renderer (`ui/packages/components/src/renderers/form/form.tsx`) draws that row as an empty full-width element; no new export. - **The slot's controls are not the header form's**: the slot element sits inside the header's `<form>`, so `FormSlotPlacement` wraps the portaled collection in a form of its own (`noValidate`, a disabled hidden default button, submit prevented). The header's `requestSubmit()` then validates only its own fields (a line cell's bad input never blocks Save with a browser bubble), a line button without a `type` (the shared `Button` sets none) never submits the header, and Enter in a line cell submits nothing: the lines behave as they did below the form, owned by no header form. The renderer's reveal of an errored field (`fieldWrapper`) skips what a host drew into this form's slot rows, while an editor inside a slot still finds its own fields. - **Section bar**: a slot row carries its group's (translated) label, once per group, and the form renderer reports a labelled slot to the host's section navigation (`FormSectionNavContext`, #34605) between the headings around it, with the slot element as its anchor. An unlabelled slot is no stop. - **Tabbed form** (`TabbedForm.tsx`): a placed collection is a tab of its own at its group's position, labelled with the group's (translated) label. A master-detail wizard is already drawn as the simple form (`ObjectForm`'s master-detail route), so it places the same way. - **The collection is drawn by `MasterDetailForm`** into the slot through a portal (`FormSlotPlacement`, a `FormSlotStore` per form in a ref), so the lines stay out of the header's React tree: a header keystroke still never re-renders them and they never re-render the header. The header reports which collections its drawn layout claims (never while it is loading), so a collection no layout claims stays in its old place below the fields, and a remounting header (after a create) does not make the lines jump below and back. An expanded row's editor opens in the same slot, beside its collection. The header scrape for the lines' `parent.*` rules skips the slot's inputs. The document totals stay at the foot of the form. - **Texts S1 left** ("below the record's fields until the form places it at the group"): `ObjectFieldGroupSchema.relatedList` describe and jsdoc, `FieldSchema.relatedList` jsdoc, the `related-list-body-table.ts` header and its describe pin, the regenerated `content/docs/references/data/object.mdx`, the acceptance line of migration entry `semantic/18.master-detail-related-list-tab-by-default`, and S1's changeset line. **ADR-0035**: one add-only note after the third note; S1's sentences are left as written (the note says which one it supersedes). - `object.form.ts`'s group help ("The parent's create and edit forms inline the table too …") makes no position claim, so it is unchanged and its bundles are not regenerated. ## Why Card #35889, acceptance line 2: 「同一个对象,加一个指向这张子表的分组并排在第二位:记录页字段区的第二个分组位置出现这张表;新建、编辑表单同一位置出现;页签里仍有它。」 S1 delivered the record page half; this delivers the form half, as agreed in the split. ## Verification Head 97afed5: main merged in after #35984 landed (three keep-both hunks in `MasterDetailForm.tsx`, nothing else). The reviews below were read at 84dc199. On the merged tree, `tsc` in plugin-form is clean and the plugin-form + form-renderer suites pass (332 files, 3354 passed / 18 skipped). - **Form ownership (L1-c should-fix)**: a DOM pin asserts every control in the slot has a form other than the header's and clicking each line button fires no header `submit` (red without the wrapper); `form-invalid-scroll.test.tsx` pins that the reveal of an errored field lands on the form's own field, not a same-named field drawn into a slot (red without the filter). Real browser (`owner-check.cjs`): 12 slot controls, 0 owned by the header; Enter in a cell and Add line make no header submit and no write; with letters in a line's Amount cell (`validity.badInput`), Create reaches the app's own check ("Amount is required", bad cells marked) with no browser bubble. Suites after the fix: 331 files, 3343 passed / 18 skipped; `tsc` clean in plugin-form and components. - **New pins (13)**: `formSlots.test.ts` (placement order, a group declared last, entry reading, nothing placed, slot store), `MasterDetailForm.groupPlacement-35889.test.tsx` (simple form between the groups around its group, an unplaced collection below the form, placed last, edit mode with loaded lines at the group and drawn once, save batch, tabbed form tab order with the collection in its tab), and one case in `form-section-nav-34605.test.tsx` (a labelled slot is a section-bar stop between the headings, an unlabelled one is not). - **Ablation**: dropping the placement (the header claims nothing) turns 4 of the DOM pins red; dropping the slot from the section-bar report turns the nav pin red. Restored, green. - **Suites**: `vitest run packages/plugin-form packages/components/src/renderers/form` 331 files, 3335 passed / 18 skipped; after merging main, `FormSectionNav` (#35988) + `ModalForm` + the new pins 8 files / 63 passed. `packages/spec` tests green; `check:generated` clean after the object.mdx regeneration. - **Static**: `tsc --noEmit` clean in plugin-form and components; eslint on the changed files 0 errors. - **Browser** (real Console on the showcase expense report, New form; light and dark at 1280 px, light at 375 px): - default form: Report section, then the Expense Lines grid inside the form; - with a temporary, uncommitted Totals field: Report, Expense Lines, Totals in that order, and the section bar reads Report / Expense Lines / Totals; - temporary tabbed form view: tabs Report / Expense Lines / Totals, the grid in the Expense Lines tab; - temporary wizard form view: drawn as the simple form, same order. All temporary edits were reverted before commit. Clause-②: no Metadata-protocol: none ## DELIBERATE CORRECTION (pending release note) `Check Changeset` is red by design: this PR rewrites one line of a pending release note it did not add, because the behaviour that line describes is the behaviour this PR changes. Restoring it would republish a false sentence. - Note: `.changeset/35889-master-detail-tab-by-default.md` (S1, #35921, unreleased). - Before: "In the entry form a placed table still sits below the record's fields, where `inlineEdit` tables sit today. Moving it to its group's place in the form is a follow-up." - After: "In the entry form a placed table sits at its group's place too: between the sections of the groups around it, or in a tab of its own (labelled with the group) in a tabbed form. A form whose sections name no field group keeps it below the record's fields." No other line of that note changes. The seat confirms this through its same-head contract-review record (landing-operations.md). ## Follow-ups (not in this PR) - `bodyTablePlacement` (plugin-detail) and `placeFormSlots` (plugin-form) now spell the same ordering rule twice; a shared pure helper would need a new export (spec or a shared ui package), so it is left as a candidate card rather than widening this PR. - A form section that references the placing group itself (`sections: [{ group: 'lines' }]`) still resolves to nothing (the group holds no fields); unchanged here. - After a jump, the section bar's brief highlight (`data-section-jumped`, #35988) styles heading rows only, so a jump to the table scrolls to it without the flash. - Neighbours: #35984 also edits `MasterDetailForm.tsx` (textual conflict, whichever lands second merges); #35923 edits `docs/adr/0035`. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [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/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgXUMw7b8gUmNsyoXHR <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgXUMw7b8gUmNsyoXHR --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
Fixes #35940
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
On a parent object's create / edit form (
MasterDetailForm→LineItemsField), a new detail line now behaves the way the record page's edit state already does (#35937):MasterDetailFormbuilds each child's static defaults withschemaDefaultValues(the values a create form of the child seeds) and passes them asnewRowValues. A default the server resolves at insert (NOW(), CEL) is left to the server.newRowRequiredShownis false until a save of the form is tried; a stored line is flagged as before.RecordBodyTableEditornow read the defaults with the session factsObjectFormthreads (currentUserId,homeCurrency,homeTimeZone), so a field defaulted to the acting user starts on that user. The editor'schildSchemacast is gone (rider 1 and 2 of comment 7051917540).form.lineItems.untouchedNotSaved("1 blank line was not saved" / "N blank lines were not saved"), on the form (also when the host suppliesonSuccess) and on the record page's edit state. Such a line is never red, before or after a refused save (GridField:isUntouchedNewRow⇒ the row waits). Once the user edits any cell, or applies the line from the row editor, it is input: saved and flagged like any other new line. On an edit form that stays open, the skipped line leaves with the save. A line typed into and then cleared stays blank and is skipped without the notice. The count is of marked lines only. A line Enter appends on the last line (fix(fields): the line grid draws no blank entry row beside Add, and its column headers show each field's help #35998) starts and is marked the same way.record-page-polish-35745.spec.tsjoinstest:e2e:live:ci; its "not stored" check asks the server with$filteronexpense_report, and it now asserts the notice.formChrome.tsdefaults rows.Read first (risk order) and the two-minute check
ui/packages/plugin-form/src/MasterDetailForm.tsx: thesaveTriedflips (set inhandleSaveandsubmitViaBatch, cleared inhandleSaved), theuntouchedSkippedRefcount insendBatch, and the edit-mode post-savefilter((r) => !isUntouchedNewRow(r)).ui/packages/fields/src/widgets/GridField.tsx:newRowWaitsnow also holds for a marked row.ui/packages/app-shell/src/views/recordEditState.tsx: the notice afterfinish()on both the no-op and success paths.Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-form/src/MasterDetailForm.test.tsx→ 17 passed, including the "ruling 7056413638" block.Tests
MasterDetailForm.test.tsx: new describe "a new line starts on the child's defaults and waits to read red": defaults shown and red only after the try; CONTROL stored line flagged at once; acting user written; Add then row-editor Apply is written. Nested "ruling 7056413638": create skip + notice with a hostonSuccess; a refused save flags the edited row, not the untouched one; edit mode drops the skipped line after save.RecordBodyTableEditor.seedContext-35940.test.tsx(new): acting user seeded; CONTROL with no known user the field starts empty.GridField.test.tsx: a marked row is never red; its first edit makes it input.RecordDetailView.harness.test.tsx: the page notice plus a parent-update-only batch; CONTROL no notice.Ablations (each applied on disk to the committed head with
scripts/ablation-replace.mjs, file restored after)GridFieldisUntouchedNewRowterm removednewRowRequiredShownprop deleted (MDF)newRowValuesprop deleted (MDF)A form-mode Add seed (row editor) ablated stayed green: the row editor's
ObjectFormalready seeds defaults through its own create detection, so that code was removed (96501c2) rather than kept untested.Acceptance notes
minRowsis out of scope (seat facts, 23:18Z).addSeededLinewaits for the child schema and sees the line start on 'Pending'; the harness counts lines before and after Add; the live spec skips the empty state's row; one GridField pin adds Enter-append. Conflicts were two append-only test blocks (both kept) and one import line (union).claude/project-thread-c6vkj1.Verification
Post-merge on b08c7f5:
vitest runMasterDetailForm, GridField, RecordBodyTableEditor*, RecordDetailView.harness → Test Files 5 passed, Tests 173 passed; GridField alone 71 passed with the Enter-append pin;@object-ui/fieldsand@object-ui/plugin-formtype-check exit 0 (closure rebuilt);check:nul-bytes,check:i18n-keysexit 0. The live spec's new row reading is left to CI's Live E2E UI on this head.Earlier readings, all on head e642739:
vitest run packages/fields packages/i18n packages/plugin-form→ Test Files 655 passed | 1 skipped, Tests 9356 passed | 21 skipped;vitest run packages/app-shell/src/views→ Test Files 1575 passed, Tests 14926 passed | 1 skipped. Declared narrowing: app-shell outsidesrc/viewswas left to CI (one run of all four packages passed 40 minutes on this 4-core box and was stopped).@object-ui/fields,@object-ui/i18n,@object-ui/plugin-form,@object-ui/app-shell(after building its closure) all exit 0.dispatch-gates --ran→ 56 derived, 56 run, 0 NOT-MEASURED, 0 UNRUN, every exit 0.check:type-check-debtfirst queue-timed out (exit 3, not measured) and was re-run under the lock: OK, 0 raw tsc errors above the ledger. uicheck:i18n-keys,check:i18n-drift,check:i18n-dead-keysexit 0.Real browser on the live stack (workspace showcase backend :4010 + built console preview)
playwright test --config=playwright.live.config.ts record-page-polish-35745.spec.ts→ 1 passed (5.8s).line-items-invalid*count 0). Create → toast "1 blank line was not saved" beside the created toast; the server holds the report and 0 lines for it ($filteronexpense_report).🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu