question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Action `redirect_to` should use Turbo by default

See original GitHub issue

Currently you need to pass turbo="true" to the <turbo-stream> element in order that is uses Turbo.visit():

<turbo-stream turbo="true" url="http://localhost:3000/" action="redirect_to"><template></template></turbo-stream>

It should use Turbo.visit() by default unless turbo="false" gets explicitly passed to the stream element.

The action already accounts for when Turbo/Turbolinks is not installed in the application and will fallback to window.location.href = url

https://github.com/marcoroth/turbo_power/blob/623a6f5b11608073ac36880bd1f0cc4745a52e56/src/actions/browser.ts#L17

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcorothcommented, Dec 8, 2022

I’m wondering what is the correct way to pass value for action (advance/replace) since it reserved keyword.

@pySilver this was resolved via #22 and was released as part of 0.1.6

0reactions
pySilvercommented, Dec 8, 2022

@marcoroth thank you for your work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redirect to new page on successful form submission ... - GitHub
I'm trying to figure out how to do this. Right now, when I submit a form from within a turbo_frame_tag , I'm reliant...
Read more >
Custom Form Handling With Turbo - Source Diving
If the response is a redirect, Turbo will follow that redirect, navigating to the new page (without a full page load) as if...
Read more >
Redirect after Turbo stream response - Hotwire Discussion
A solution for me was to add a data-controller=“redirect” and set the URL value on the wrapping div from flash message. The path...
Read more >
HTTP redirects in a Turbo-Rails app - DEV Community ‍ ‍
The reason behind this is the spec for 302 Found states that the redirected request should use the same HTTP method as the...
Read more >
conditionally respond with html OR turbo_stream
Sometimes you want the same action to respond to different formats. ... it will respond with format turbo_stream by default!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found