Hi!
I’ve been trying the 8.0.X update for turbo, since working with multiple turbo_frame
files was a bit of a headache I was excited for this new morph thing.
My issue, or question I guess, is: what if i want this kind of layout updates as a consequence of a GET request?
A simple example, a table of records which can be filtered with a form.
<div>
<%= form_with(url: users_path, method: :get, data: { controller: 'table-filters', turbo_stream: '', turbo_permanent: '' }, html: {id: 'filters'}) do |f| %>
<%= text_field_tag :full_name, '', data: {action: "input->table-filters#search"} %>
<%= text_field_tag :email, '', data: {action: "input->table-filters#search"} %>
<% end %>
<table>
<!-- ... @users.each do |u| ... -->
</table>
</div>
The table-filters
controller just does a form.requestSubmit()
with a debounce.
To me, using a post
for this action doesn’t make sense and, while the data-turbo-stream
makes the form accept a stream response, you still see the query string params because it is still a get request.
Should I just accept this? Am I missing something?
I can see multiple use cases where you want to update parts of your layout with strictly GET requests (filters, validation, charts, …) so it feels a bit weird that there’s no immediate way of doing this without falling back on the cumbersome usage of multiple turbo_frame.erb
files
Thanks in advance!