Repository navigation
fix(plugin-form): a sectioned object-form clears after a save on submitBehavior continue and resetOnSuccess - #27663
Merged
Conversation
…inue and resetOnSuccess SimpleObjectForm's flat and sectioned form nodes now read one shared resetOnSubmit expression; the sectioned node carried none, so a grouped "save and add another" form kept the saved record's values. Claude-Session: https://claude.ai/code/session_01Utp6CY2n1JmZZKrHgtp9jC Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CY2n1JmZZKrHgtp9jC Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC 席位核对ACCEPT · head
Generated by Claude Code |
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC
Requested by Bill · project thread
Fixes #27602
Clause-②: no
Metadata-protocol: none
维护者速读
object-form的分组(sections)表单现在与平铺表单读同一条「保存后清空」规则,submitBehavior: { kind: 'continue' }或新建表单上的resetOnSuccess: true在保存后清空表单。ui/packages/plugin-form/src/ObjectForm.tsx的resetOnSubmit常量及分组路径form节点新加的一行;再看ObjectForm.resetOnSubmit-27602.test.tsx。pnpm --dir ui exec vitest run packages/plugin-form/src/ObjectForm.resetOnSubmit-27602.test.tsx,预期 6 个测试全绿(平铺、分组各 3 个)。What changes
SimpleObjectFormrenders anobject-formblock through one of twoformnodes: the flat one, and the sectioned one (explicitsections, or sections derived from the object's field groups). Only the flat node carriedresetOnSubmit, so a sectioned "save and add another" form kept the saved record's values while the same declaration on a flat form cleared it.The rule is now one named const,
resetOnSubmit, declared once besideformLayoutand read by both nodes:The expression is unchanged from the flat path's; the flat node now reads the const instead of its own copy, and the sectioned node gains the same key. Nothing else resets the form imperatively: the
continuearm of the submit-behaviour switch is a no-op whose comment already defers toresetOnSubmit, and the form renderer's singleform.reset()call after a successful submit is the only reader.Changeset:
@object-ui/plugin-formpatch.Tests
ui/packages/plugin-form/src/ObjectForm.resetOnSubmit-27602.test.tsxrenders the same block flat and sectioned (describe.eachover both paths) and savesname: 'Alpha', reading the field once the submit button is enabled again (the form disables it for the whole submit, reset included):submitBehavior: { kind: 'continue' }clears, on both paths;resetOnSuccess: trueon a create form clears, on both paths;Alpha, on both paths.Ablation, run once, on the committed fix (
97c6b181), throughscripts/ablation-replace.mjs. The mutation deleted the sectioned node'sresetOnSubmit,line (anchor 1 → 0, blob1fa7f7aa0930→5c7ae6369dbf). Result: the two sectioned clear cases went red and the other four stayed green (Tests 2 failed | 4 passed (6)). The restore was verified with blob == HEAD and an emptygit diff HEAD. The test imports./ObjectFormfrom source, so no build sits between the mutation and the run.Acceptance notes
ObjectFormthe block registers.no-explicit-any; the new test's four come from the sameas anyschema and data-source casts its siblingObjectForm.showReset-27247.test.tsxuses.Verification
Local runs below were taken on head
57e13970.Targeted tests, type-check, lint
The whole-package run is from the pre-merge commit. The merge brought no change under
plugin-form, so after it the five files above were run again, including the form renderer test the merge added beside theresetOnSubmitreader inform.tsx.Derived gate families (dispatch-gates --commands, reconciled with --ran)
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran FILEprinted:34 derived famil(ies) accounted for — 34 run, 0 NOT-MEASURED. Every family CI runs beyond these (lint, type-check lanes, Test UI, Build & E2E UI) is read from this PR's check-runs.Generated by Claude Code