Skip to content

fix(webapp): hard-navigate after creating an organization - #4530

Merged
carderne merged 1 commit into
mainfrom
claude/fix-org-create-form-error-reset
Aug 11, 2026
Merged

fix(webapp): hard-navigate after creating an organization#4530
carderne merged 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 / After

Before — submitting the new-organization form could drop you back on the creation form, with no error message anywhere and nothing to say the submit had succeeded, while the organization had in fact already been created. The natural next step was to click Create again — which created a second organization.

After — submitting the form completes and takes you to your new organization. If creating it genuinely fails, you get an error message on the form with what you typed still there.

How

Once the organization row is committed, the action redirects to the new organization, which redirects on again to its first page. That whole chain was being followed client-side: the router received the action's redirect, fetched the destination's loaders, followed the next redirect, and then had to load the destination route's code chunk before it could render anything.

That last step is where it broke. A capture of a real reproduction shows the navigation being aborted while the destination route's chunk was still loading. Remix's recovery for a chunk that fails to load is window.location.reload(), and because the router had not yet committed the new URL, the reload re-requested the URL still in the address bar — the creation form. The user landed back on the form with the organization already created, because the action had run to completion on the server. Clicking Create a second time then made a duplicate.

The two success redirects now use redirectDocument() instead of redirect(). That returns the same redirect response with an added reload-document marker, which the router acts on by handing the destination straight to the browser as a full document navigation. It does this before it starts the destination's loaders, so neither those loaders nor the destination route's code chunk are ever fetched client-side — the step the navigation was being lost on no longer happens.

The <Form> is unchanged from main. Remix still handles the submission itself, so the client-side zod validation and the pending/disabled state on the Create button behave exactly as before.

Deliberately not done: turning the submit itself into a native document POST via reloadDocument on the <Form>. An earlier revision of this PR did that, and it was removed. It takes the submission out of Remix's hands, and with it the pending navigation state that disables the Create button while the form is submitting — weakening the very double-click guard that stops the duplicate. It also re-initialises the page's React state on the error path, dropping the URL and company-size selections. Changing only the action's redirects leaves the submission, the validation and the disabled-button state exactly where they were, and hardens just the navigation after success.

The action's failure path is also tightened up: it returns a conform-shaped result and logs the underlying error, so a genuine failure is rendered with its message and the submitted values preserved instead of resetting silently.


Testing

Tested locally against a dev webapp, driving the real form in a browser:

  • A normal submit creates the organization and lands on the post-creation page.
  • The action's redirect response carries the reload-document marker, and the destination is then loaded as a document navigation (302 to the organization, then 200 on its first page), with no client-side loader or route-chunk request for it — this is the behaviour change that closes the window.
  • Injecting the original failure — aborting the destination route's chunk mid-navigation — reproduces the old symptom before the change and no longer reproduces it after.
  • The Create button still becomes disabled while the form is submitting, confirming the existing double-click guard is intact.
  • Exactly one organization row is created per submit, confirmed by querying Postgres per submitted name before and after each submit.
  • Client-side validation still gates the submit: an empty name and a too-short name both show the inline zod error, never reach the action, and create no organization.

Also ran pnpm run format, pnpm run lint:fix, and pnpm run typecheck --filter webapp — all clean.


Follow-ups

Not addressed here, to keep this change small:

  • seedDefaultBillingAlerts is awaited inline after the organization row is committed, which adds latency to a request the user is waiting on. It cannot fail the request — it is wrapped in tryCatch and only logs — but it is still worth moving off the critical path. The inline await is deliberate, though: it stops the seed landing after the user's first alert edit, so any move off the request path has to preserve that ordering.
  • The same client-side redirect chain exists on other creation forms, most notably project creation. Whether to harden those the same way is a separate call.

Changelog

Fixed the new-organization form so submitting it completes and takes you to your new organization, instead of sometimes landing you back on the creation form after the organization had already been created.


Screenshots

No visual changes — the form and the page it lands on are unchanged. The fix is in how the navigation after a successful submit is performed.

💯

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 52feba2

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 52feba2.

18/100 over 414 measured of 430 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 414 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  169 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       414 applicable,  12 pass, 223 sole, global without it 63
  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.

@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
@carderne
carderne force-pushed the claude/fix-org-create-form-error-reset branch from 3157d9a to 708d4d0 Compare August 11, 2026 13:02

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@708d4d0

trigger.dev

npm i https://pkg.pr.new/trigger.dev@708d4d0

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@708d4d0

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@708d4d0

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@708d4d0

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@708d4d0

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@708d4d0

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@708d4d0

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@708d4d0

commit: 708d4d0

@claude
claude Bot force-pushed the claude/fix-org-create-form-error-reset branch from 708d4d0 to ba81b12 Compare August 11, 2026 13:53
@claude claude Bot changed the title fix(webapp): show an error instead of silently resetting the new-organization form fix(webapp): make the new-organization form submit work on the first click Aug 11, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 new potential issues.

Open in Devin Review

Comment thread apps/webapp/app/routes/_app.orgs.new/route.tsx Outdated
Comment thread .server-changes/fix-new-organization-form-submit.md Outdated
Comment thread apps/webapp/app/routes/_app.orgs.new/route.tsx
Once the organization row was committed, the action returned a client-side
redirect and the browser navigated on through a chain of redirects to the
new organization's first page. That navigation could be aborted while the
destination route's code was still loading, and the browser then went back
to /orgs/new — leaving the user sitting on the creation form with what they
typed still in place, even though the organization had in fact been created.
Clicking Create again made a duplicate.

The success redirects now use redirectDocument(), so the browser performs a
hard navigation to the destination instead of client-side routing into its
chunks, which is the window that broke. Remix still handles the submission
itself, so the zod validation and the pending/disabled state on the Create
button behave exactly as before.

The failure path also returns a conform-shaped result and logs the
underlying error, so a genuine failure renders its message with the
submitted values preserved instead of resetting silently.

Co-Authored-By: Claude <noreply@anthropic.com>
@claude
claude Bot force-pushed the claude/fix-org-create-form-error-reset branch from ba81b12 to 52feba2 Compare August 11, 2026 14:02
@claude claude Bot changed the title fix(webapp): make the new-organization form submit work on the first click fix(webapp): hard-navigate after creating an organization Aug 11, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

Open in Devin Review

Comment thread apps/webapp/app/routes/_app.orgs.new/route.tsx
Comment thread apps/webapp/app/routes/_app.orgs.new/route.tsx
@carderne
carderne merged commit 8819e25 into main Aug 11, 2026
49 checks passed
@carderne
carderne deleted the claude/fix-org-create-form-error-reset branch August 11, 2026 15:00
@github-actions github-actions Bot mentioned this pull request Aug 11, 2026
ericallam pushed a commit that referenced this pull request Aug 13, 2026
## Summary
4 new features, 24 improvements, 10 bug fixes.

## Highlights

- Allow `trigger deploy` to authenticate with an environment API key
from `TRIGGER_ACCESS_TOKEN`.
([#4561](#4561))

## Improvements
- Chat in the browser now reconnects when the connection drops mid-turn,
instead of leaving the reply stuck as if it were still generating.
Reports can be fetched as structured data with the `json` format, and
the shortest report period is now one minute (`1m`, `30m`, `1h`, `7d`).
The `mint-token` command's help is clearer too: a token minted without
`--cap` is read-only, and `--ttl` shows the correct maximum lifetime of
7 days.
([#4418](#4418))
- The dev environment onboarding now tracks real progress. After you run
`init`, the setup checklist marks your project as initialized, and it
updates live as your dev server connects and your tasks register. The
blank state also adds a "Copy AI agent prompt" button that copies a
ready-to-paste setup prompt (pre-filled with your project reference) for
Claude Code, Cursor, or any coding agent.
([#4563](#4563))
  
The `init` scaffold now imports from `@trigger.dev/sdk` instead of the
deprecated `@trigger.dev/sdk/v3` subpath.
- Deployed images now ship dependencies and bundled task code as
separate layers. Repeat deploys with unchanged dependencies typically
push and pull far less data, making deploys and worker image pulls
faster.
([#4551](#4551))
- The current-worker API now reports each task's queue, so you can see
which tasks write to a given queue.
([#4525](#4525))
- Watch-mode chat streams now survive quiet windows and page reloads,
and a reply cut off by a lost connection shows an error instead of
appearing finished. Aborting a resumed subscription only closes your
local stream — call `stopGeneration(chatId)` or pass `stopOnAbort: true`
to stop the run. Also fixed a race where quickly restarting a stream
could break stop and reconnect, and stopping a chat now hands it back to
your other tabs instead of leaving them read-only.
([#4516](#4516))

## Server changes

These changes affect the self-hosted Docker image and Trigger.dev Cloud:

- The dashboard agent now has a monthly message allowance and plan-based
limits on watches. Queries stay read-only with clearer errors when busy,
and messages with unusual characters no longer fail to send.
([#4516](#4516))
- Meet the dashboard agent: a chat in every environment that answers
questions about your runs, queues, errors and health with real data and
links, replacing Ask AI everywhere it used to appear. Investigate a
failed run, an error, a backed-up queue or a run that hasn't started to
get a worked-through answer — what happened, why, and how to fix it,
with every claim linked to the runs, errors and deploys behind it. It
reads your data read-only, works on preview and dev branches with that
branch's own data, and reads the same everywhere — dashboard, terminal,
editor. A very long chat keeps working: the agent summarises the earlier
part and carries on.
  
**Watch…** on a run, queue, error or the health report tells you when
things change: a run finishes, a queue clears or grows past a number you
pick, an error comes back, an environment recovers. The answer arrives
in the chat and, if you want, by email, Slack or webhook — and the agent
can look into bad news on its own. A watch reaches you on any browser
you sign in from, without opening the chat first.
  
A sample of conversations is scored automatically so the agent keeps
getting better; only the score and a one-line summary are kept, never
your messages, data or code, and we can switch it off for your
organization on request. Ask the agent instead of the Docs buttons in
page headers — they stay there when the agent isn't available to you.
Separately, a queue's wait times, peak depth, throughput and throttling
can now be read from the API.
([#4418](#4418))
- Add backend support for delaying cron schedules within a specified
window with a minimum of 60 seconds.
([#4566](#4566))
- Reduced recurring background database load from the billing-limit
recovery check, so paused environments are reconciled with less
overhead.
([#4590](#4590))
- Validating a schedule when deploying or updating a schedule now does
less work on projects with many preview branches, so those operations
stay fast as branches accumulate.
([#4598](#4598))
- Project pages now load faster for projects with a large number of
preview branches, by no longer loading archived branch environments that
aren't shown.
([#4595](#4595))
- Database queries that filter on a list of values now reuse cached
query plans more consistently, instead of forcing the database to
re-plan whenever the list length changes.
([#4480](#4480))
- Routine cleanup of old dashboard agent data now runs on its own
schedule.
([#4599](#4599))
- Database connection metrics are now reported for every configured
database connection instead of only the primary one, and stay accurate
regardless of connection type.
([#4541](#4541))
- Deployment-related API endpoints now draw from their own generous rate
limit budget, configurable via the `DEPLOYMENT_RATE_LIMIT_*` environment
variables, so runtime API traffic no longer competes with deployments
for the same per-environment budget.
([#4565](#4565))
- Deleting or editing a secret environment variable is now fast and no
longer slows down as a project accumulates variables.
([#4555](#4555))
- Speed up personal access token lookups by indexing them on their owner
([#4588](#4588))
- Switching project or organization in the sidebar now keeps you on the
same page instead of sending you back to Tasks. Pages for a specific
run, deploy or other single item open the matching list instead.
([#4585](#4585))
- Reduced database load when loading the dashboard by removing an unused
organization member count that was being calculated on every page
navigation.
([#4587](#4587))
- The environment variables page now loads a page at a time, keeping it
fast for projects with a large number of variables. Search matches
variable names across every page.
([#4597](#4597))
- Groundwork for an alternative database connection driver, gated behind
configuration and disabled by default, so there is no change to default
behavior.
([#4539](#4539))
- Deleting an alert channel is now fast and no longer slows down as a
project builds up alert history.
([#4554](#4554))
- Reduced internal overhead on the API under high load.
([#4532](#4532))
- Out-of-date upgrade prompts no longer appear in the dashboard: the
"V4" badges and the notices saying preview branches and the queues table
need V4 have been removed. The side menu still warns you when a project
is on v3, with updated wording and a link to the v4 upgrade guide.
([#4589](#4589))
- Make background worker registration cheaper for projects with many
scheduled tasks by scoping declarative schedule reconciliation to the
current environment and dropping redundant schedule lookups.
([#4577](#4577))
- Speed up setting and importing environment variables for projects with
many variables.
([#4579](#4579))
- Loading the deployments list is now faster, especially when filtering
by deployment status on projects with many deployments.
([#4591](#4591))
- Fixed the billing limits page timing out for organizations with many
preview branches, especially while a spend limit was being enforced. The
page now loads quickly, so you can raise or resolve your limit without
delay. ([#4594](#4594))
- Fix the Concurrency page showing the plan's default concurrency for
the dev environment instead of the environment's actual limit.
([#4596](#4596))
- Creating an organization sometimes left you back on the creation form
even though the organization had already been created, so clicking
Create again made a duplicate. Creating an organization now completes
and takes you to your new organization.
([#4530](#4530))
- Ensure creating a project completes instead of returning to its
creation form after a navigation error.
([#4584](#4584))
- Renaming a project now keeps you on the project settings page and
tells you what happened, instead of silently moving you to the tasks
page or clearing the form with no explanation.
([#4601](#4601))
- Fixed support threads showing no account details for some customers,
so the team can see your plan, organizations and projects when you get
in touch.
([#4575](#4575))
- In the light theme, the Format, Clear and Copy buttons on the query
editor no longer blend into the query text behind them.
([#4592](#4592))
- The health report now says start latency is "unknown" when there is no
data for it, instead of showing a healthy-looking 0ms
([#4544](#4544))
- Realtime streams written inside a chat session run now use the same
backend as the session itself, and runs are no longer created against a
backend that cannot serve them.
([#4564](#4564))
- The grouped "watch updates" notification now shows the total number of
results waiting, instead of only the most recent batch's count.
([#4525](#4525))

<details>
<summary>Raw changeset output</summary>

# Releases
## @trigger.dev/build@4.5.11

### Patch Changes

- Updated dependencies:
  - `@trigger.dev/core@4.5.11`
## trigger.dev@4.5.11

### Patch Changes

- Chat in the browser now reconnects when the connection drops mid-turn,
instead of leaving the reply stuck as if it were still generating.
Reports can be fetched as structured data with the `json` format, and
the shortest report period is now one minute (`1m`, `30m`, `1h`, `7d`).
The `mint-token` command's help is clearer too: a token minted without
`--cap` is read-only, and `--ttl` shows the correct maximum lifetime of
7 days.
([#4418](#4418))
- Allow `trigger deploy` to authenticate with an environment API key
from `TRIGGER_ACCESS_TOKEN`.
([#4561](#4561))
- The dev environment onboarding now tracks real progress. After you run
`init`, the setup checklist marks your project as initialized, and it
updates live as your dev server connects and your tasks register. The
blank state also adds a "Copy AI agent prompt" button that copies a
ready-to-paste setup prompt (pre-filled with your project reference) for
Claude Code, Cursor, or any coding agent.
([#4563](#4563))

The `init` scaffold now imports from `@trigger.dev/sdk` instead of the
deprecated `@trigger.dev/sdk/v3` subpath.

- Deployed images now ship dependencies and bundled task code as
separate layers. Repeat deploys with unchanged dependencies typically
push and pull far less data, making deploys and worker image pulls
faster.
([#4551](#4551))
- Updated dependencies:
  - `@trigger.dev/core@4.5.11`
  - `@trigger.dev/build@4.5.11`
  - `@trigger.dev/schema-to-json@4.5.11`
## @trigger.dev/core@4.5.11

### Patch Changes

- Chat in the browser now reconnects when the connection drops mid-turn,
instead of leaving the reply stuck as if it were still generating.
Reports can be fetched as structured data with the `json` format, and
the shortest report period is now one minute (`1m`, `30m`, `1h`, `7d`).
The `mint-token` command's help is clearer too: a token minted without
`--cap` is read-only, and `--ttl` shows the correct maximum lifetime of
7 days.
([#4418](#4418))
- The current-worker API now reports each task's queue, so you can see
which tasks write to a given queue.
([#4525](#4525))
## @trigger.dev/python@4.5.11

### Patch Changes

- Updated dependencies:
  - `@trigger.dev/core@4.5.11`
  - `@trigger.dev/sdk@4.5.11`
  - `@trigger.dev/build@4.5.11`
## @trigger.dev/react-hooks@4.5.11

### Patch Changes

- Updated dependencies:
  - `@trigger.dev/core@4.5.11`
## @trigger.dev/redis-worker@4.5.11

### Patch Changes

- Updated dependencies:
  - `@trigger.dev/core@4.5.11`
## @trigger.dev/rsc@4.5.11

### Patch Changes

- Updated dependencies:
  - `@trigger.dev/core@4.5.11`
## @trigger.dev/schema-to-json@4.5.11

### Patch Changes

- Updated dependencies:
  - `@trigger.dev/core@4.5.11`
## @trigger.dev/sdk@4.5.11

### Patch Changes

- Chat in the browser now reconnects when the connection drops mid-turn,
instead of leaving the reply stuck as if it were still generating.
Reports can be fetched as structured data with the `json` format, and
the shortest report period is now one minute (`1m`, `30m`, `1h`, `7d`).
The `mint-token` command's help is clearer too: a token minted without
`--cap` is read-only, and `--ttl` shows the correct maximum lifetime of
7 days.
([#4418](#4418))
- Watch-mode chat streams now survive quiet windows and page reloads,
and a reply cut off by a lost connection shows an error instead of
appearing finished. Aborting a resumed subscription only closes your
local stream — call `stopGeneration(chatId)` or pass `stopOnAbort: true`
to stop the run. Also fixed a race where quickly restarting a stream
could break stop and reconnect, and stopping a chat now hands it back to
your other tabs instead of leaving them read-only.
([#4516](#4516))
- Updated dependencies:
  - `@trigger.dev/core@4.5.11`

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants