Skip to content
Permalink

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
Choose a base ref
...
head repository: hotwired/turbo-rails
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.13
Choose a head ref
  • 4 commits
  • 18 files changed
  • 3 contributors

Commits on Mar 2, 2025

  1. 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.
    seanpdoyle authored Mar 2, 2025
    Configuration menu
    Copy the full SHA
    3fcec46 View commit details
    Browse the repository at this point in the history
  2. 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.
    seanpdoyle authored Mar 2, 2025
    Configuration menu
    Copy the full SHA
    80bb910 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2025

  1. Configuration menu
    Copy the full SHA
    34fdefe View commit details
    Browse the repository at this point in the history
  2. Bump version

    jorgemanrubia committed Mar 3, 2025
    Configuration menu
    Copy the full SHA
    77f3604 View commit details
    Browse the repository at this point in the history
Loading