Bridge between LiveComponent and Templates.
This module is a thin orchestrator that:
- Selects the appropriate template based on state
- Prepares minimal assigns for the template
- Delegates rendering to the template
Architecture
LiveComponent → Renderer (bridge) → Template → Shared (components)Performance Optimization
Renderer passes two key assigns to templates:
@static- Same reference always, LiveView skips re-render (O(1) comparison)@state- Changes trigger re-render only for parts using dynamic fields
Templates should use:
@static.*for columns, filters, ui_adapter, etc. (no re-render on user interaction)@state.*for page, filter_values, selected_ids, etc. (re-renders when changed)
See MishkaGervaz.Table.Web.Live,
MishkaGervaz.Table.Web.State,
MishkaGervaz.Table.Templates.Table,
MishkaGervaz.Table.Behaviours.Template.
Summary
Functions
Whether the table has nothing to draw yet.
Renders the table through the template currently in effect.
Functions
@spec first_read_out?(MishkaGervaz.Table.Web.State.t()) :: boolean()
Whether the table has nothing to draw yet.
True from the component's first render until the first read comes back, and never again — a later page, filter or sort keeps the rows on screen and marks them stale instead.
@spec render(map()) :: Phoenix.LiveView.Rendered.t()
Renders the table through the template currently in effect.
Until the first read returns, the template's MishkaGervaz.Table.Behaviours.Template.render_loading/1
is drawn instead of its render/1. After that, render/1 is passed @static, @state, the
@stream for the resource's stream name and an @empty? flag.