This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(form): a later submit outcome supersedes this form's earlier one - #7342
Merged
Merged
Conversation
A refused submit raised an error toast that nothing ever retired, so the confirmation of a later, successful submit of the same form appeared beside the refusal of the earlier one — a wizard's last step showing "Invalid project status transition." and "Your new project is ready…" at the same time. The two toasts are raised by two different modules, which is why neither could supersede the other on its own. The refusal comes from the form renderer in @object-ui/components: WizardForm hands it `onSubmit: handleStepSubmit`, that handler rethrows a rejected write, and the renderer's own catch sets the in-form banner AND toasts. The success toast is WizardForm's. Every outcome toast a form raises now travels under one stable per-form id: - the renderer publishes its three outcome toasts (the field-level rejection, an `onAction` error and a rejected write) under that id, and retires the previous attempt's toast in the same place it already cleared the previous attempt's in-form banner — so by the time a host can confirm a success, this form's last refusal is gone; - the console's FormPage publishes its confirmation and its submit failure under one id, closing the same asymmetry in a single function. Measured, not assumed: the refusal toast is not sticky by configuration. ConsoleToaster sets `duration: 4000` for every severity, @object-ui/components' own Toaster sets none (sonner's default TOAST_LIFETIME is also 4000), and `duration: Infinity` appears nowhere on any form path. Durations are therefore untouched — the defect is supersession, and it reproduces inside any lifetime. Deliberately excluded: the refused redirect DESTINATION keeps its own toast. The write succeeded there and only the declared destination is out of contract, so that refusal has to stay readable beside the confirmation it qualifies. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
os-litant
marked this pull request as ready for review
September 2, 2026 11:55
os-litant
pushed a commit
that referenced
this pull request
Sep 2, 2026
…arlier one (#7345) MasterDetailForm raised its two save outcomes as two unrelated toasts: handleSaved's confirmation and handleError's refusal, each under sonner's auto-generated id. Nothing held a handle on the previous attempt's toast, so a save the server refused left its error on screen and the confirmation of the corrected retry landed beside it — the form ending on a screen that asserted both outcomes at once. This is the objectui#7252 defect class on a renderer PR #7342 did not touch: its surface was the SDUI form renderer and the console's FormPage, and both outcomes here are raised by this file, one line apart. Both now travel under one stable per-form id (React.useId()-scoped, "form-outcome:" + the id — the spelling #7342 landed), and each save attempt dismisses that id before it starts. The two halves close two different paths: - no host onSuccess (SDUI / embedded): the built-in confirmation is the fallback, and the shared id makes it supersede the refusal rather than stack beside it; - host onSuccess (the console): the built-in confirmation is deliberately skipped, so a shared id alone would retire nothing — the dismissal is what stops a stale refusal from standing over a save that succeeded. Measured, not assumed: the pin fails on that path with the id alone. Durations are untouched — the defect is supersession, and it reproduces inside any lifetime. Measured while pinning this and deliberately NOT changed here: a refused master-detail save currently puts the same refusal on screen twice, because the parent ObjectForm's renderer also toasts the write it re-threw. That is a distinct defect from supersession and is filed separately; the pin is written so its assertions do not depend on how many raisers report an outcome. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho
This was referenced Sep 2, 2026
akarma-synetal
pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Sep 9, 2026
…arlier one (objectstack-ai#7356) * fix(plugin-form): a later master-detail save outcome supersedes the earlier one (objectstack-ai#7345) MasterDetailForm raised its two save outcomes as two unrelated toasts: handleSaved's confirmation and handleError's refusal, each under sonner's auto-generated id. Nothing held a handle on the previous attempt's toast, so a save the server refused left its error on screen and the confirmation of the corrected retry landed beside it — the form ending on a screen that asserted both outcomes at once. This is the objectui#7252 defect class on a renderer PR objectstack-ai#7342 did not touch: its surface was the SDUI form renderer and the console's FormPage, and both outcomes here are raised by this file, one line apart. Both now travel under one stable per-form id (React.useId()-scoped, "form-outcome:" + the id — the spelling objectstack-ai#7342 landed), and each save attempt dismisses that id before it starts. The two halves close two different paths: - no host onSuccess (SDUI / embedded): the built-in confirmation is the fallback, and the shared id makes it supersede the refusal rather than stack beside it; - host onSuccess (the console): the built-in confirmation is deliberately skipped, so a shared id alone would retire nothing — the dismissal is what stops a stale refusal from standing over a save that succeeded. Measured, not assumed: the pin fails on that path with the id alone. Durations are untouched — the defect is supersession, and it reproduces inside any lifetime. Measured while pinning this and deliberately NOT changed here: a refused master-detail save currently puts the same refusal on screen twice, because the parent ObjectForm's renderer also toasts the write it re-threw. That is a distinct defect from supersession and is filed separately; the pin is written so its assertions do not depend on how many raisers report an outcome. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho * test(plugin-form): let the toast doubles inherit sonner's surface Four fixtures replaced the whole `toast` export with a hand-listed object carrying only `success` and `error`. The moment MasterDetailForm called one more sonner method, every test that mounts it died with "toast.dismiss is not a function" — 16 failures across 4 files, none of them about what those files assert. This is the check:vi-mock-inherit defect one level down: those factories already spread the real module (`...actual`), but froze the export surface again inside `toast`. Spreading `actual.toast` and overriding only the two methods each file spies on closes the class rather than this one method — the next sonner call the form makes cannot break them either. No assertion changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho --------- Co-authored-by: Claude <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #7252
A refused submit raised an error toast that nothing ever retired, so the confirmation of a later, successful submit of the same form appeared beside the refusal of the earlier one. Every outcome toast a form raises now travels under one stable per-form id, so the later outcome supersedes the earlier one instead of stacking beside it.
Where the two toasts actually come from
The card's premise named
apps/console/src/components/FormPage.tsxas the source of both toasts. That is not the reported flow, and reading the whole submit path is what showed it:FormPagerenders a flat form — its own sections and its own bare form element, no step machinery — and its success toast is the literaltoast.success('Submitted'). It is the/f/:slugpublic-form and internal-form route, not the wizard the card describes (whose success toast read "Your new project is ready…", i.e. an authoredsuccessMessage).ObjectForm→WizardForm(packages/plugin-form/src/WizardForm.tsx).WizardFormrenders each step through the SDUIformrenderer in@object-ui/componentsand hands itonSubmit: handleStepSubmit. That handler callsschema.onErrorand rethrows a rejected write, so the rejection surfaces in the renderer's catch — which sets the in-form banner and toasts (packages/components/src/renderers/form/form.tsx). The success toast isWizardForm's own.So the refusal and the confirmation are raised by two different modules, which is exactly why neither could supersede the other on its own, and why the fix lands in the renderer rather than in
WizardForm.What was measured rather than assumed
The refusal toast is not sticky by configuration.
ConsoleToastersetstoastOptions.duration: 4000for every severity,@object-ui/components' ownToastersets none (sonner 2.0.8'sTOAST_LIFETIMEis also 4000), andduration: Infinityappears nowhere on any form path in this repo — the only match in the tree is a test fixture inapp-shell. Durations are therefore left exactly as they are: the defect is supersession, and it reproduces inside any lifetime, because the two toasts are simply unrelated.The change
packages/components/src/renderers/form/form.tsx— one stable per-form id (React.useId(), scoped to this form instance so nothing takes unrelated toasts down with it). All three of this renderer's outcome toasts publish under it (the field-level rejection, anonActionerror, a rejected write), and the previous attempt's toast is retired in the same place the previous attempt's in-form banner was already cleared. By the time a host can confirm a success, this form's last refusal is gone.apps/console/src/components/FormPage.tsx— a bounded in-place fix of the same defect class, in the file the claim named.handleSubmitthere already cleared itserrorbanner at the top of every attempt but published its toast under sonner's auto-generated id, so a refused submit's toast survived into the confirmation of the retry — the card's Expected, violated in a single function. Its confirmation and its submit failure now share one id. Evidence that this is the same class and not a drive-by: the two toasts sit 85 lines apart in one handler whose first statements aresetSubmitting(true); setError(null);, i.e. the identical banner-cleared/toast-not asymmetry. Scan boundary: every othertoast.errorcall site in the repo was read; the only other member of this class found isMasterDetailForm.tsx(a separate renderer with its own submit path), reported to the PM rather than fixed here.Deliberately excluded: the refused redirect destination (objectui#4190) keeps its own toast. The write succeeded there and only the declared destination is out of contract, so that refusal has to stay readable beside the confirmation it qualifies — folding it into the shared id would silently delete the confirmation of a write that really happened. The second FormPage test pins that.
Out of scope by the card's own text and untouched here: the state-machine refusal and its localisation (objectstack-ai/objectstack#14311 remains open), and deriving a create form's allowed initial values from
stateMachine.Does this need a rebase? Checked, not assumed — no
origin/mainmoved from this branch's fork pointebc05b4d6to2956d7af8(11 commits) while the work was in flight. Neither file this PR edits moved.git diff --name-only ebc05b4d6..origin/mainrestricted topackages/components/src,packages/plugin-form/srcandapps/console/srcreturns exactly four files, none of them mine:packages/plugin-form/srcis untouched on main across that range, andgit merge-treeagainst the currentorigin/mainreports zero conflict markers. Deliberately not rebased or merged here — the merge queue rebuilds.Tests
Both pins assert what remains on screen, not call counts —
toast.errorwas called andtoast.successwas called is true before and after the fix, which is precisely the reading under which the defect looks fine. Each replaces the toast module with a registry modelling the one sonner behaviour the fix relies on: raising a toast under an id the registry already holds replaces that entry, anddismiss(id)removes exactly that one.packages/plugin-form/src/WizardForm.outcomeToastSupersede.test.tsx— the card's flow end to end: last step Create refused with a 400, Back a step, forward, Create accepted; the assertion is that only the success toast remains. The navigation is load-bearing — it is what proves the renderer instance (and therefore the id) survives a step change. Plus: two consecutive refusals leave one toast, not two.apps/console/src/components/FormPage.outcomeToast.test.tsx— refuse-then-accept on the public form path, and the guard that a refused redirect destination still shows beside the confirmation.Run at
dbed63dd3:type-checkcovers the new tests, not just the sources:tsc --listFilesOnlyonpackages/plugin-form/tsconfig.test.jsonand onapps/console/tsconfig.jsoneach resolve the new file (1 hit apiece).Gate union re-run at
dbed63dd3, each quoted from the gate's own verdict line:Ablation (after the commit; both legs proved on disk, both restored by blob hash)
No
distis involved: the rootvitest.config.mtsaliases@object-ui/componentstopackages/components/src(line 415), so the pins resolve the edited source directly — which the red legs below confirm, since mutatingsrcalone turned them red.expected [ { type: 'error', … }, …(1) ] to deeply equal [ { type: 'success', … } ], i.e. two outcomes on screen at once. Mutation proved by grep on the removed text (id: outcomeToastId→ 0 occurrences,toast.dismiss(outcomeToastId)→ 0, injectedtoast.error(errorMessage);→ 1). Restored withgit checkout HEAD -- ABSOLUTE_PATH;git diff HEADempty andgit hash-objectback to the HEAD blob5d01245f79d3418ff41c07d30e9f4eb15476f85b.FormPage: the supersession test RED (expected [ { type: 'error', … }, …(1) ] to deeply equal [ { type: 'success', … } ]) and the redirect-refusal guard GREEN — the predicted narrow change detector, since that guard never depended on the id. Restored the same way; blob back to2de9ac81934deafcf6db36de4bc3ad32057c18a0,git statusclean.Narrowed lint, declared
Repo-wide
eslint .is CI's run. Locally this was narrowed to the four changed.ts/.tsxfiles:0 errors, 98 warnings, every warning a pre-existing pattern in these files (@typescript-eslint/no-explicit-any,react-refresh/only-export-components, one pre-existing unused type import) and no package here sets--max-warnings. The narrowing is safe to read as a measurement because (1) the linted population is**/*.{ts,tsx}minus**/dist,**/.next,**/node_modules,**/public,**/.source, read fromeslint.config.jsitself rather than guessed; (2) the file count is4, read from--format json; (3)eslint.config.jsconfigures no type-aware linting — noparserOptions.projectand noprojectService— so every rule is single-file and this diff cannot move the verdict of any file it did not touch.🤖 Generated with Claude Code
https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho