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

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

Open
phil-6 opened this issue Feb 13, 2024 · 5 comments · May be fixed by #595
Open

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

phil-6 opened this issue Feb 13, 2024 · 5 comments · May be fixed by #595

Comments

@phil-6
Copy link

phil-6 commented Feb 13, 2024

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

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

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

@seanpdoyle
Copy link
Contributor

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

@nikolaokonesh
Copy link

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
Copy link
Contributor

@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
Copy link

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

seanpdoyle added a commit to seanpdoyle/turbo-rails that referenced this issue Mar 3, 2024
Closes [hotwired#579][]

Extends the `turbo_stream` tag builder helper to create `<turbo-stream
action="refresh">` elements through the pre-existing
`turbo_stream_refresh_tag` method.

[hotwired#579]: hotwired#579
@seanpdoyle seanpdoyle linked a pull request Mar 3, 2024 that will close this issue
@seanpdoyle
Copy link
Contributor

I've opened #595 to implement this.

seanpdoyle added a commit to seanpdoyle/turbo-rails that referenced this issue Apr 4, 2024
Closes [hotwired#579][]

Extends the `turbo_stream` tag builder helper to create `<turbo-stream
action="refresh">` elements through the pre-existing
`turbo_stream_refresh_tag` method.

[hotwired#579]: hotwired#579
seanpdoyle added a commit to seanpdoyle/turbo-rails that referenced this issue Apr 4, 2024
Closes [hotwired#579][]

Extends the `turbo_stream` tag builder helper to create `<turbo-stream
action="refresh">` elements through the pre-existing
`turbo_stream_refresh_tag` method.

[hotwired#579]: hotwired#579
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants