Title: fix(webapp): show the toast when saving project general settings by claude[bot] · Pull Request #4601 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: fix(webapp): show the toast when saving project general settings by claude[bot] · Pull Request #4601 · triggerdotdev/trigger.dev
X Title: fix(webapp): show the toast when saving project general settings by claude[bot] · Pull Request #4601 · triggerdotdev/trigger.dev
Description: Requested by Chris Arderne · Slack thread
Related to #4324
Before / After
Before: an org member without project-manage permission renames a project on the general settings page, hits Save, and lands on the tasks page with no message at all. The code intends to show "You don't have permission to rename this project", but nothing appears — the rename silently does nothing. The same silence applied to a successful rename: the "Project renamed to ..." toast never showed either.
After: you stay on the general settings page you submitted from, and the toast explains what happened — either the permission error or the rename confirmation.
This makes the reason visible; it does not change who is allowed to rename a project.
Why the message disappeared
The toast is a flash value in the __message cookie. The root loader (app/root.tsx) reads it with session.get("toastMessage") — which deletes the flash — and commits the emptied session on the same response. So the message survives exactly one hop that runs the root loader.
These redirects pointed at the project root, /orgs/:org/projects/:project. That route's _index loader doesn't render anything; it immediately redirects again to the environment's tasks page. On a client navigation Remix fetches every matched route's loader in parallel, so the root loader ran for that intermediate hop, spent the flash, and returned a Set-Cookie clearing it — and then the router threw that hop's data away because a sibling loader redirected. By the time the tasks page rendered, the cookie was already empty.
Ruled out along the way: the Set-Cookie is not dropped on the action's redirect, shouldRevalidate is not blocking the reader, and nothing swallows the thrown Response.
Worth knowing generally: any redirectWithSuccessMessage / redirectWithErrorMessage whose target is itself a redirecting route loses its message for this reason, since the flash is read and cleared on a hop that renders nothing. Other call sites are likely affected. Fixing the class properly — forwarding the Set-Cookie through internal redirects, or reading the flash somewhere other than root — is a bigger architectural change than this PR should carry, so it deliberately stays out of scope: this PR only fixes the call sites in this one route.
How
redirectWithErrorMessage / redirectWithSuccessMessage in the general settings action now target v3ProjectSettingsGeneralPath(...) instead of v3ProjectPath(...). That removes the intermediate redirect hop entirely, so the very next request renders the toast.
Redirecting back to the form is also the better behaviour on its own terms — a save that fails shouldn't move you off the page you were working on. The alternative fixes were worse: reading the flash somewhere other than root would need the toast plumbing rewritten for one call site, and having the project _index loader forward the cookie would leave the same trap set for every other caller that redirects through it. redirectDocument() was considered (per #4146's sibling fix for stale route chunks) and isn't relevant here — the settings route is already loaded, and this was never a chunk-loading failure.
Applied to all four project-root redirects in the file: rename denial, rename success, delete denial, and delete failure.
Delete success has the same defect and is deliberately left alone. It redirects to the org root /orgs/:org, whose _index loader has no branch that renders — every path throws a redirect — so "Project deleted" is swallowed the same way. The project you'd return to no longer exists, and there is no org-level page that both renders and makes sense to land on after a delete (the org has no projects list; the only rendering org pages are the settings subtree, "new project" and invites). Relocating where people land after deleting something is a worse trade than a missing confirmation, so the destination stays as it is and the release note doesn't promise a message for deletion.
The default-region action in …env.$envParam.regions/route.tsx was checked — it already redirects to regionsPath(...), its own rendering page, so it never lost its message and is unchanged.
The other silent path
With the redirects fixed, the two json({ errors: { body: … } }) returns were the only remaining way to fail this form with nothing on screen. That shape isn't a conform SubmissionResult, so when it reached useForm({ lastResult }) conform called reset() and threw the message away: blank form, no error, submit re-enabled. Both now return json(submission.reply({ formErrors: [...] })), and the rename form renders renameForm.errors the way the delete form on the same page already did.
The as any on useActionData() stays. dashboardAction is generic over TReturn extends Response, so useActionData
Open Graph Description: Requested by Chris Arderne · Slack thread Related to #4324 Before / After Before: an org member without project-manage permission renames a project on the general settings page, hits Save, and land...
X Description: Requested by Chris Arderne · Slack thread Related to #4324 Before / After Before: an org member without project-manage permission renames a project on the general settings page, hits Save, and land...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/4601
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:31f97ddf-5622-2877-614a-8e9b2d672934 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D9F4:1E77:65D58B:97C976:6AFAF3F8 |
| html-safe-nonce | 6edb975ac86a648d55f8d9e69fd2ca62e1c888c7ff1ac071d0920874d4892a0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUY0OjFFNzc6NjVENThCOjk3Qzk3Njo2QUZBRjNGOCIsInZpc2l0b3JfaWQiOiI2ODE4OTUyNTYzNTU1NzU5MDk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 253c6a34544bcf8b88db06d17ec215de6525810d6af0fd0cc7703414b00b7d90 |
| hovercard-subject-tag | pull_request:4270048203 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/4601/files |
| twitter:image | https://avatars.githubusercontent.com/in/1236702?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1236702?s=400&v=4 |
| og:image:alt | Requested by Chris Arderne · Slack thread Related to #4324 Before / After Before: an org member without project-manage permission renames a project on the general settings page, hits Save, and land... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0178036d8230524a18422872393ab7e708443ae4c2047f758560a2db870c1913 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a85e96a83bed7871993e6b1ffda24105928eee17 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width