The first drawback of the no-JS approach can be mitigated by this code in the controller:
class PostsController < ApplicationController
...
def index
respond_to do |format|
format.html
format.turbo_stream { @pagy, @posts = pagy_countless(Post.all) }
end
end
...
It ensures that posts are loaded for turbo_stream requests only.
Good point. I think if I were to avoid the initial query, I would leave the post index action blank and have the turbo frame tag call an entirely different route. That should work as well.
PS Sample applications