hotwired / turbo

The speed of a single-page web application without having to write any JavaScript
https://turbo.hotwired.dev
MIT License
6.65k stars 421 forks source link

Redirecting without a URL hash #671

Closed j-sieg closed 2 years ago

j-sieg commented 2 years ago

Hello, first issue here.

I was creating a typical CRUD interface for a resource. After creation I respond with a redirect to a URL with a hash, but it only redirects to the URL without the hash.

Here's some logs from my server:

POST "/resource" for 127.0.0.1
Redirected to http://localhost:3000/resource#resource_20
Started GET "/resource"

I'm using Rails and Rails only logs the URL on GET requests (no hash included) but it does respond w/ the hash intact on the browser (so no problem there).

I posted this issue here because redirecting w/ a hash works when I turn Turbo off (data-turbo="false") for the form I'm using.

t27duck commented 2 years ago

See https://github.com/hotwired/turbo/issues/211

There isn't really a fix as it's related to the browser fetch API.

j-sieg commented 2 years ago

Thanks @t27duck. Closing this since it's a duplicate.