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

turbo_frame_tag src: format: turbo_stream call back refresh morph. #1218

Open
nikolaokonesh opened this issue Mar 3, 2024 · 0 comments
Open

Comments

@nikolaokonesh
Copy link

I use infinite scroll with a turbo frame, it works constantly when moving through pages. When Morph is updated on the page, Turbo_frame_tag is completely reloaded. If I use data-turbo-permanent then scrolling is called repeatedly. refresh="morph" doesn't work

posts_controller.rb

def index
  @posts = Post.paginate(page: params[:page], per_page: 4)        # gem will_paginate
end

posts/ index.html.erb

<div  data-turbo-permanent>
  <%= turbo_frame_tag "posts", src: posts_path(format: turbo_stream), loading: "lazy", refresh: "morph" %>
</div>

posts/ index.turbo_stream.erb

<% turbo_stream.append "posts" do %>
  <%= render partial: "posts/post", controller: @posts %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant