There's one thing that I felt was missing from the CableReady ecosystem and should be doable: lazy loading
I introduce:
with a helper in your template
<%= futurize @posts %>
custom <futurism-elements>
(in the form of a <div>
or a <tr is="futurism-table-row">
are rendered. Those custom elements have an IntersectionObserver
attached that will send the dom_id
to an ActionCable channel (FuturismChannel
) which will then replace the placeholders with the actual resource partial.
With that method, you could lazy load every class that has to_partial_path defined (ActiveModel has by default).
You can pass the placeholder as a block:
<%= futurize @posts do %>
<td class="placeholder"></td>
<% end %>