You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit baf2678
Browse filesBrowse the repository at this point in the historyBrowse files
fix(plugin-form): a placed row editor is not nested in a form, and a save refused on placed lines marks their tab (#36088)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuVwX4pUdM1qvNLSqRZNSvv3)_Fixes#36019
Clause-②: no
Metadata-protocol: none
Skills-docs: none — no authorable key and no behaviour a skill teaches
moves
repo:objectstack#1 · os-sales · session_01L6bhgW85kwjGaz7HqsmEuv
## 维护者速读
-
用户能看到什么变化:在“表头加明细”的录入表单里,明细表放在某个字段分组处时,展开一行明细编辑不再在开发控制台报“表单嵌套表单”的警告;分页签的表单里,保存被服务器以某一行明细为由拒绝时,明细所在的页签会像表头字段出错时一样标红点。
- 为什么做:这是“明细表放在字段分组处”那项工作(主从表单布局)评审时留下的两条收尾意见,补上明细出错时用户找不到原因的缺口。
- 出错会怎样:最坏情况是明细页签该标红没标、或多标了一个页签,保存本身照旧被拒、数据不会写错;整个改动可直接撤回。
- 要你做什么:无
## What changes
1. **Row editor in a placed slot (N2 of the L2 record on #36009).**
`FormSlotPlacement` takes `ownsForm`: when its children already are a
form of their own, it portals them into the slot with no wrapper form.
The expanded row editor (an `ObjectForm`, its only other control a
`type="button"`) is placed with `ownsForm`, so its form is no longer a
React child of the slot's wrapper form, and React's DOM-nesting check
stops logging "form cannot be a descendant of form". This is the
measured S2 patch, re-applied on main (`git apply --check` clean,
offsets +24/+78).
2. **Tab marker for a refused line (N3 of the L2 record, L1-c's nit).**
A batch refusal is attributed to the placed collections it was refused
on, using the same evidence the record page's
`attributeRecordEditRefusal` reads: the operation the server names in
`details.failedOperation.index` when it names one (a line's operation,
never operation 0, the parent), else each field in `fields[]` that only
line operations write. A field the parent operation carries stays the
header form's to mark. `FormSlotStore` records those collection ids
(`refuse(ids)`, cleared when the next save gets past validation, as the
renderer clears its own markers). `TabbedForm` subscribes to the store
and rebuilds its slot rows, each carrying `slotRefused` when its
collection was refused. The form renderer's `erroredFieldTabs` marks the
tab of a refused slot row with the treatment a refused header field gets
(`data-error`, destructive text, the dot).
No export, prop or i18n key is added. `FormSlotHost` and `FormSlotRow`
live in `formSlots.ts`, which `@object-ui/plugin-form` does not export.
The renderer reads `slotRefused` off a `form-slot` row the same way it
reads `slotRef`: a key only a host can produce.
## Tests
- `MasterDetailForm.groupPlacement-35889.test.tsx`, existing describe:
an expanded row editor opens in the slot beside its collection, its
inputs are owned by its own form, and no nesting warning is logged.
- Same file, new top-level describe (a refused save marks the tab of the
placed lines it was refused on): a field only a line writes marks the
lines tab and not the header tab; a server-named failed line operation
marks the lines tab; control: a refusal on the header's own field marks
its tab and leaves the lines tab unmarked.
- `formSlots.test.ts`: `refuse` marks the slot row until retired,
de-duplicates, and an equal refusal emits nothing.
All readings at head `9ac514e3`.
<details><summary>Suites and type-check</summary>
- `pnpm exec vitest run --maxWorkers=2 packages/plugin-form/
packages/components/src/renderers/form/` (from `ui/`, under the verify
lock): `Test Files 332 passed (332)`, `Tests 3359 passed | 18 skipped
(3377)`, `VERDICT command-exit 0`.
- `pnpm --filter @object-ui/plugin-form --filter @object-ui/components
run type-check` (both run `tsc --noEmit && tsc -p tsconfig.test.json`):
`VERDICT command-exit 0`.
- `eslint` over the six changed source and test files: 0 errors (106
warnings, all on lines this diff does not touch).
</details>
<details><summary>Ablations (one per fix, through
`scripts/ablation-replace.mjs`, restore proven)</summary>
- Fix 1: `ownsForm` removed from the row editor's placement (anchor 1 to
0, blob `632b58a14b7d` to `f73ce79e3a8b`). The nesting pin goes red with
React's own message, "In HTML, a FORM cannot be a descendant of a FORM"
(its DOM-nesting check); `Tests 1 failed | 10 passed (11)`. Restored:
blob equals HEAD (`632b58a14b7d`), `git diff HEAD` empty. This mutation
is the code on `main`, so the pin fails on `main` and passes with the
fix.
- Fix 2: the `slotStore.refuse(...)` call in `sendBatch`'s catch deleted
(anchor 1 to 0, blob to `2e2969a6db0b`). Both tab pins go red, and the
control (a header-field refusal) stays green; `Tests 2 failed | 9 passed
(11)`. Restored: blob equals HEAD, `git diff HEAD` empty.
</details>
<details><summary>Derived gate families</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 38 commands. Every one exited 0. `--ran`
reconciliation: "38 derived famil(ies) accounted for — 38 run, 0
NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of
them is 3)". The type-check lanes, artifact rosters and wide-population
families are CI's.
</details>
<details><summary>Overlap</summary>
`node scripts/pm/overlap-check.mjs --branch=HEAD --pr=36039,36054`:
origin/main, #36039 and #36054 each merge cleanly, `VERDICT clean exit
0`.
</details>
## Acceptance notes
- The marker is the whole of the header-field treatment that applies
here. A refused header field also activates its tab and focuses the
field; a refused line does not switch tabs, because the renderer's catch
runs before the host's refusal reaches the tab rows, and the lines show
no per-row reason today (the master-detail form shows the refusal as the
form's banner, as before). The acceptance names the marker only.
- A refusal that names neither a failed operation nor a field (a lock, a
permission denial) is on no collection, and marks nothing, as before.
- File surface beyond the claim's wording: the tab marker is drawn by
the form renderer
(`ui/packages/components/src/renderers/form/form.tsx`), not by
`TabbedForm`, and the refusal travels through `formSlots.ts`. Both are
named here.
- The editor's form still sits inside the header's form in the DOM (the
slot element is inside it), as the lines' wrapper form already did;
ownership is answered by the innermost form, which the pin asserts.
## Verification
Two-minute check: `pnpm --dir ui exec vitest run --maxWorkers=2
packages/plugin-form/src/MasterDetailForm.groupPlacement-35889.test.tsx`:
expect 11 tests passed.
Read first: (1) `MasterDetailForm.tsx` `refusedChildObjects` and its
call in `sendBatch` (which refusals count as a line's); (2) `form.tsx`
`erroredFieldTabs` (the renderer's new read); (3) `TabbedForm.tsx` the
`useSyncExternalStore` on the slot host.
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgW85kwjGaz7HqsmEuv
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(ui): a placed line table's row editor is a form of its own, and a refused line marks its tab
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
Two fixes to a master-detail entry form whose field group places the line table:
12
+
13
+
- Opening a line's row editor no longer draws the editor's form inside the placed table's wrapper form. The markup is valid again, and React no longer logs "form cannot be a descendant of form" in development. The editor's inputs still belong to the editor's own form.
14
+
- In a tabbed form, a save the server refuses on a line marks the tab that holds the lines, the way a refused header field marks its own tab. A refusal is on the lines when the server names a line's operation as the failed one, or names a field that only the lines write. The mark clears when the next save gets past validation.
0 commit comments