Skip to content

fix(webapp): show an error instead of silently resetting the new-organization form - #4530

Open
claude[bot] wants to merge 1 commit into
mainfrom
claude/fix-org-create-form-error-reset
Open

fix(webapp): show an error instead of silently resetting the new-organization form#4530
claude[bot] wants to merge 1 commit into
mainfrom
claude/fix-org-create-form-error-reset

Conversation

@claude

@claude claude Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Requested by Chris Arderne · Slack thread

Before: If anything failed while creating an organization, the new-organization form silently reset — the name you typed disappeared, no error was shown, and the Create button became clickable again. It looked like the submit had simply not registered, so the natural next step was to retype the name and press Create again. But the organization row itself is committed early in the request, so the retry could produce a second organization.

After: The name you typed is kept, and a form-level error explains what happened and suggests checking your organization list before trying again. The failure is also logged server-side, which it wasn't before.

How: The action's catch block returned json({ errors: { body: error.message } }), which is not a conform SubmissionResult. When that got passed to useForm({ lastResult }), conform's report() saw no initialValue, reset the form, and threw the error away — hence the blank field and the missing message. The catch now returns submission.reply({ formErrors: [...] }) wrapped in a 400, which is the shape conform expects, so the submitted value is echoed back and the error is surfaced. The page had no slot for form-level errors at all, so a <FormError id={form.errorId}>{form.errors}</FormError> was added below the fields. useActionData() is now typed as useActionData<typeof action>() (the as any on lastResult is gone), so a future shape mismatch here is a type error rather than a silent reset — this required dropping the ActionFunction annotation in favour of ActionFunctionArgs so the return type is inferred.


✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

pnpm run format, pnpm run lint:fix and pnpm run typecheck --filter webapp were all run locally and pass. The failure path itself was not exercised in a running dashboard — it needs an induced server error during organization creation.


Changelog

The new-organization form now keeps the name you typed and shows an error when creation fails, instead of clearing itself with no explanation.


Follow-ups (not in this PR)

  • json({ errors: { body: ... } }) is returned from 11 other route files under apps/webapp/app/routes/, and 9 of those also drive a conform form, so they carry the same latent behaviour. Left alone here to keep the diff focused on the reported path.
  • seedDefaultBillingAlerts is awaited inline in createOrganization, holding the request open for up to 5s after the organization row is already committed. Moving it off the request path would narrow the window in which a request can fail with the organization already created.

Screenshots

None — the change is a message that only appears on a server error.

💯

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3157d9a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Observability map

As of 3157d9a.

18/100 over 413 measured of 429 entry points (base 18, no change)

What this PR changed

route base head now failing
/_app/orgs/new 0 50

FIX FIRST

  • /api/v1/projects/:projectRef/envvars (sensitive) - auth-boundary, request-context
  • /auth/sso (sensitive) - auth-boundary, request-context
  • /_app/orgs/:organizationSlug/settings/team (sensitive) - error-classification, auth-scope, request-context

AUDIT 3 of 50 sensitive mutations record an actor. 47 without one.
CONTEXT 12 of 413 entry points name a tenant on a failure path. 325 appear only here, 39 of them sensitive, in the JSON rather than the fix list.

What the score is made of
CHECKS
  error-classification  168 applicable,  94 pass,   0 sole, global without it 10
  auth-boundary          62 applicable,  57 pass,   0 sole, global without it 15
  auth-scope             19 applicable,  17 pass,   0 sole, global without it 18
  request-context       413 applicable,  12 pass, 223 sole, global without it 64
  audit-trail            50 applicable,   3 pass,   0 sole, not in the score

The score and findings here are report-only and never gate the merge. Separately, a required test suite keeps this tool's symbol and route lists in sync with the code they name, and can fail a pull request that renames or removes a symbol they reference, or that adds the first route with a segment they anticipate. Each failure names the list to edit. The rules and their reasons: internal-packages/observability-map/README.md.

…nization form

Co-Authored-By: Claude <noreply@anthropic.com>
@claude
claude Bot force-pushed the claude/fix-org-create-form-error-reset branch from 2c4ee48 to 3157d9a Compare August 7, 2026 12:57
@claude
claude Bot marked this pull request as ready for review August 7, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant