-
Notifications
You must be signed in to change notification settings - Fork 338
Permalink
Choose a base ref
{{ refName }}
default
Choose a head ref
{{ refName }}
default
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also or
learn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Learn more about diff comparisons here.
base repository: hotwired/turbo-rails
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.12
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
...
head repository: hotwired/turbo-rails
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.13
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
- 4 commits
- 18 files changed
- 3 contributors
Commits on Mar 2, 2025
-
Drop Support for
ruby@2.x.x
(#698)Commit to requiring `ruby@3.1` Remove `ruby@2.6`, `ruby@2.7`, `ruby@3.0`, `rails@6.1`, and `rails@7.0` from the CI matrix, along with any `RUBY_VERSION < "3"` conditionals. The implementation changes include replace older syntaxes with newer variants. For example, utilize `...` in place of `*args, &block`, rely on `**`-ing attribute `Hash` arguments, etc.
Configuration menu - View commit details
-
Copy full SHA for 3fcec46 - Browse repository at this point
Copy the full SHA 3fcec46View commit details -
turbo_stream
tag builder: support:partial
with block (#701)The Background --- Consider an application with a shared `application/flash` partial that accepts its message as a partial-local assignment: ```erb <%# app/views/application/_flash.html.erb %> <p role="alert"><%= message %></p> ``` Also consider an `application/layout.turbo_stream.erb` template for appending the `Flash` messages to a element with `[id="flashes"]`: ```erb <%# app/views/layouts/application.turbo_stream.erb %> <% flash.each do |name, message| %> <%= turbo_stream.append "flashes", partial: "application/flash", locals: { message: message } %> <% end %> ``` This works as you'd expect, since the `:partial` and `:locals` keyword arguments are forwarded along to the underlying `render` call. The Scenario --- Now consider that the `application/flash` message changed its interface to expect the `message` as block content yielded to the partial instead of an assignment to the `:locals` options: ```diff <%# app/views/application/_flash.html.erb %> -<p role="alert"><%= message %></p> +<p role="alert"><%= yield %></p> ``` The `layouts/application.turbo_stream.erb` template would need to change as well: ```diff <%# app/views/layouts/application.turbo_stream.erb %> <% flash.each do |name, message| %> - <%= turbo_stream.append "flashes", partial: "application/flash", locals: { message: message } %> + <%= turbo_stream.append "flashes", partial: "application/flash" do %> + <span style="color: red"><%= message %></span> + <%= end %> <% end %> ``` The Problem --- This style of invocation of `turbo_stream.append` does not work the same as if it were passed a block of content generated by calling `render` with the same keywords. The presence of a `&block` argument triggers an entirely separate code path than the presence of the `**rendering` keywords. To work around this issue, you'd have to capture the rendering separately: ```diff <%# app/views/layouts/application.turbo_stream.erb %> <% flash.each do |name, message| %> - <%= turbo_stream.append "flashes", partial: "application/flash", locals: { message: message } %> + <% content = capture do %> + <%= render partial: "application/flash" do %> + <span style="color: red"><%= message %></span> + <% end %> + <% end %> + + <%= turbo_stream.append "flashes", content %> <% end %> ``` The Proposal --- This commit alters the tag builder's decision making process to incorporate a check for a combination of both a `&block` and `:partial` or `:layout` keyword arguments.
Configuration menu - View commit details
-
Copy full SHA for 80bb910 - Browse repository at this point
Copy the full SHA 80bb910View commit details
Commits on Mar 3, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 34fdefe - Browse repository at this point
Copy the full SHA 34fdefeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 77f3604 - Browse repository at this point
Copy the full SHA 77f3604View commit details
There are no files selected for viewing