Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only pass :request_id option to Refresh Stream #603

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seanpdoyle
Copy link
Contributor

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.

@seanpdoyle seanpdoyle force-pushed the request-id-partial-local branch 2 times, most recently from 30243ac to bb56fbc Compare March 15, 2024 16:39
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.

[Action view strict locals]: https://guides.rubyonrails.org/action_view_overview.html#strict-locals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant