Replace instead of advance on Turbo form response redirect

When submitting a form with Turbo Drive resolves to a redirect, it advances the browser history. Speaking in Turbo Drive terms, this is a Turbo.visit("/redirected_to_here", { action: "advance" }). I have a scenario where I would like the redirect to replace the browser history, simulating a Turbo.visit("/redirected_to_here", { action: "replace" }).

The Application Visit guides have the solution for anchor tags, by annotating with a data-turbo-action="replace". Guessing at an API, I attempted putting a data-turbo-action="replace" on the form tag, and the submit tag, but neither resulted in the desired behavior.

Is the desired behavior of redirection-as-replace possible with the current capabilities of Turbo?

3 Likes

We’re having the same problem, @danott.

Were you able to fix this?