Skip to content

Redirect create actions with 303 See Other so Turbo advances - #2536

Merged
maebeale merged 2 commits into
mainfrom
maebeale/turbo-create-see-other
Sep 18, 2026
Merged

maebeale merged 2 commits into
mainfrom
maebeale/turbo-create-see-other

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 one-line status change on 6 create redirects + a request spec each

Fixes a Turbo bug where a successful create didn't advance the page: the record saved but the user stayed on the form, so re-clicking Save produced duplicate records.

  • Why: Turbo Drive needs a 303 See Other (not 302) to navigate after a form POST. These create actions redirected with a plain 302, so Turbo didn't move on. The update actions already used :see_other — this just aligns create to match.
  • Added status: :see_other to the create-success redirect in community_news, stories, events, workshops, resources, video_recordings, each with a request spec asserting 303.

Scope

  • The same 302-after-POST gap exists on other create/destroy actions across the app (e.g. organizations, grants, people, features, sectors…). This PR fixes the content-form controllers where the duplicate-record symptom was reported. Happy to do a broader sweep in a follow-up if wanted — a blanket change is avoided here because some of those redirects are guard/error paths where 303 isn't the right call.

Turbo Drive needs a 303 (not 302) to navigate after a form POST. Without it,
a successful create doesn't advance the page — the record saves but the user
stays on the form and can re-submit, producing duplicate records. The update
actions already used :see_other; align the create success redirects to match.

Covers community_news, stories, events, workshops, resources, video_recordings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maebeale
maebeale requested a review from jmilljr24 September 14, 2026 17:44
@maebeale
maebeale marked this pull request as ready for review September 14, 2026 17:44
A real headless-browser test of the community news create flow, asserting the
page leaves the form for the show page and exactly one record is created. It
passes with a plain 302 as well as with 303, documenting that a POST create
advances under Turbo either way — the see_other requirement is real only for the
PATCH/DELETE update/destroy paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@jmilljr24 jmilljr24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I did a good bit a digging and finally found an explanation that made sense to me.

This pr would be considered "best practice" according to the turbo docs. A browser may handle other 3xx responses fine but the official support if for a redirect_to to set 303 with see_other.

Couldn't tell you if that was actually the root cause or it was a weird timing/server issue but I'm good with add see_other on this. Thanks

@maebeale
maebeale merged commit 5572930 into main Sep 18, 2026
3 checks passed
@maebeale
maebeale deleted the maebeale/turbo-create-see-other branch September 18, 2026 20:40

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@maebeale Did you intend to leave this in?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ack, i merged before seeing this comment. ok w you to leave in?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I commented after the merge so not on you. Yeah, no biggie. Just brought it up in case you had different intentions for it and forgot. I'm not concerned with it.

maebeale added a commit that referenced this pull request Sep 20, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 21, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 21, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 24, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 25, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 29, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 29, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 30, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 30, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Sep 30, 2026
Aligns with the See Other convention from #2536, picked up in the rebase
onto main, so a Turbo form submission advances instead of re-rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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