Code Monkey home page Code Monkey logo

Comments (16)

danjac avatar danjac commented on July 21, 2024 2

@seanpdoyle using beta 4. Turbo header is not sent with POST request, only GET.

from turbo.

Intrepidd avatar Intrepidd commented on July 21, 2024 1

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.

tleish avatar tleish commented on July 21, 2024 1

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.

jmfederico avatar jmfederico commented on July 21, 2024 1

I am still experiencing the issue in beta-4.

GET (links) send the header.
POST (form submissions) do not.

from turbo.

tleish avatar tleish commented on July 21, 2024 1

@tleish that's intentional: see #52 and #127.

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.

kaspth avatar kaspth commented on July 21, 2024

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.

kaspth avatar kaspth commented on July 21, 2024

Ah! Yeah, that should be set, and if not, it's a bug.

from turbo.

weaverryan avatar weaverryan commented on July 21, 2024

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.

danjac avatar danjac commented on July 21, 2024

I can confirm this issue (using Django):

  1. Request inside turbo frame using a link: Turbo-Frame header present.
  2. Request inside turbo frame using a form submission: Turbo-Frame header not present.

from turbo.

tleish avatar tleish commented on July 21, 2024

If you prefer an alternative approach than PR #110 I'm happy to work on it.

from turbo.

oleksandr avatar oleksandr commented on July 21, 2024

Run into the same issue today (using hotwire with Golang backend). Looks like the suggested fix is still hanging :-\

from turbo.

seanpdoyle avatar seanpdoyle commented on July 21, 2024

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.

tleish avatar tleish commented on July 21, 2024

@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.

tleish avatar tleish commented on July 21, 2024

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.

seanpdoyle avatar seanpdoyle commented on July 21, 2024

@tleish that's intentional: see #52, #127, and hotwired/turbo-site#40 (comment).

from turbo.

Intrepidd avatar Intrepidd commented on July 21, 2024

I confirm as well, header is still not sent for my POST use-case

from turbo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.