hotwired / turbo-rails

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

`refresh` action is missing from Turbo::Streams::TagBuilder #579

Closed phil-6 closed 1 month ago

phil-6 commented 8 months ago

Attempting to user format.turbo_stream { render turbo_stream: turbo_stream.refresh('target') }

Raises a NoMethodError: undefined methodrefresh' for an instance of Turbo::Streams::TagBuilder`

I think the new refresh action needs to be added into the TagBuilder model

seanpdoyle commented 8 months ago

@jorgemanrubia is the <turbo-stream action="refresh" request-id="..."> element meant for public consumption, or is it an implementation detail of broadcasts_refreshes?

nikolaokonesh commented 8 months ago

Guys, explain to me why when I click on links I am taken to the top, “scroll: :preserve” does not work turbo-rails v2.0.2 rails 7.1.3

<head>
    ....
    <%= turbo_refreshes_with method: :morph, scroll: :preserve %>
    <%= yield :head %>
</head>

worked well in --pre versions after update not work

seanpdoyle commented 8 months ago

@nikolaokonesh your question does not seem related to this issue, and might be better suited as an Issue of its own.

With that being said, are you confident that the <meta> elements are being rendered into the document's <head>? If you call turbo_refreshes_with after the yield :head call, does it behave as you'd expect?

nikolaokonesh commented 8 months ago

@seanpdoyle I tried other options, it doesn't work.

seanpdoyle commented 7 months ago

I've opened https://github.com/hotwired/turbo-rails/pull/595 to implement this.