hotwired / turbo-rails

Use Turbo in your Ruby on Rails app
https://turbo.hotwired.dev
MIT License
2.03k stars 305 forks source link

Only pass `:request_id` option to Refresh Stream #603

Open seanpdoyle opened 3 months ago

seanpdoyle commented 3 months ago

When rendering <turbo-stream> elements for broadcasting, omit the :request_id partial-local variable.

When rendered partials utilize Action View strict locals, the extra variable raises an error:

unknown local :request_id

By omitting the :request_id from the Turbo::Broadcastable#broadcast_rendering_with_defaults, it isn't passed as part of partial rendering.

Likewise, since broadcast_refresh never renders a partial, but instead builds an empty <turbo-stream action="refresh" request-id="..."></turbo-stream> element, the :request_id local variable isn't necessary.