Comments (16)
@seanpdoyle using beta 4. Turbo header is not sent with POST request, only GET.
from turbo.
Sorry if it wasn't clear, I was advocating to set the Turbo-Frame
header only when a form within a frame is being submitted
from turbo.
In the following example, only the first GET button will include a request header with Turbo-Frame
, the other 2 do not include it in the header.
<%= turbo_frame_tag 'user_frame' do %>
<%= button_to('Edit User', '/users/1', method: "get") %> <!-- ADDS header['Turbo-Frame'] -->
<%= button_to('Save', '/users/1', method: "post") %> <!-- NO header['Turbo-Frame'] -->
<%= button_to('Delete', '/users/1', method: "delete") %> <!-- NO header['Turbo-Frame'] -->
<% end %>
Is this intended or a bug?
using: @hotwired/turbo 7.0.0-beta.3
from turbo.
I am still experiencing the issue in beta-4.
GET (links) send the header.
POST (form submissions) do not.
from turbo.
Ah. I did not realize this was intentional. I also didn't realize I could not use turbo-stream with a GET method.
from turbo.
Adding the Turbo-Frame
header on non-frame requests would blur the concept of frames.
For invalid forms, we recommend responding with the 422 HTTP status and the form contents will be replaced. See #39. You can also respond with turbo streams.
from turbo.
Ah! Yeah, that should be set, and if not, it's a bug.
from turbo.
Hi!
If this is a bug, then I can also confirm it :). Inside the a frame, when I click a link, I can see the Turbo-Frame
header. When I submit a form right below that link (inside the same frame), the Turbo-Frame
header appears to be missing.
Cheers!
from turbo.
I can confirm this issue (using Django):
- Request inside turbo frame using a link: Turbo-Frame header present.
- Request inside turbo frame using a form submission: Turbo-Frame header not present.
from turbo.
If you prefer an alternative approach than PR #110 I'm happy to work on it.
from turbo.
Run into the same issue today (using hotwire with Golang backend). Looks like the suggested fix is still hanging :-\
from turbo.
As part of #142, we changed how the headers are constructed from a merge operation to a direct mutation. Combined with #127, all form submissions (GET or POST, inside a frame or referencing one from the outside) should result in a requests with the Turbo-Frame header.
That behavior was shipped as part of https://github.com/hotwired/turbo/releases/tag/v7.0.0-beta.4.
@Intrepidd @danjac @oleksandr are you still experiencing this issue?
from turbo.
@seanpdoyle — created this JSFiddle to show the headers being sent. Click any of the buttons and see the headers sent through fetch below the buttons. Turbo only adds turbo-frame to header on a GET.
from turbo.
One other item to note, should the GET request also include text/vnd.turbo-stream.html
in the accept header (which it currently does not)?
from turbo.
@tleish that's intentional: see #52, #127, and hotwired/turbo-site#40 (comment).
from turbo.
I confirm as well, header is still not sent for my POST use-case
from turbo.
Related Issues (20)
- [Breaking changes] Turbo 8: Scroll position is lost on render when an ID is duplicated in the page
- Not working when a "." is in the path. HOT 1
- Morph action for streams not part of 8.0.4 but in docs HOT 1
- attribute that will cancel the page request on hover HOT 1
- turbo didn't get noticed of new content
- Head merge issue with turbo frame navigation promoted to a page visit HOT 4
- Custom rendering issue when clicking browser back button
- Turbo Morph with Dialog causes issues HOT 1
- Turbo frame history not navigating properly w/ back button after upgrading from 7 to 8 HOT 1
- Turbo.setConfirmMethod is not working HOT 1
- Proposal: Adding `Turbo.confirm` for programmatic confirmation dialogs HOT 3
- Turbo does not cancel pending requests that were prefetched on consecutive link clicks
- button with `popovertarget` not triggering in form (Safari 17)
- Turbo from not triggered when using submit button with form attribute HOT 6
- How execute js code in rails 7 'create.turbo_stream.erb' file HOT 3
- Blurred input refocusing when turbo replaces blurred input HOT 4
- Script tags are reexecuted when navigating back from a page with an error status code using browser's back button HOT 1
- Eager-loaded frame fetches but does not render its src HOT 1
- Server-side redirect from turbo stream to file download fails in Turbo 8
- Firefox issue with `scroll-behavior: smooth` and Turbo enabled (v8.0.4) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbo.