At the bottom of a long web page (i.e. in a view template, say long_page.html.erb
) I've some heavy content that slows down page loading.
Because this heavy content is placed at the bottom of the page and because users do not always scroll to the bottom of the page, I thought to use a lazy-loaded <turbo-frame>
so that the heavy content is loaded only when the user scroll the page at the bottom, which obviously improves the overall loading performance of the page.
How can I make that within the same view template with proper <turbo-frame>
settings, which would avoid me creating new controller actions and new view templates?
At the bottom of the long web page I tried to add something like this:
# long_page.html.erb
<turbo-frame id="heavy_content_inside" loading="lazy" src="path/to/long_page">
^^^^^^^^^^^^^^^^^
<% # heavy computed content that slows down page loading %>
</turbo-frame>
but I'm getting the error in console:
Error: Matching element has a source URL which references itself