Skip to content

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

Open
maebeale wants to merge 2 commits into
mainfrom
maebeale/turbo-create-see-other
Open

maebeale wants to merge 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>
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