# `MishkaGervaz.Table.Web.Renderer`
[🔗](https://github.com/mishka-group/mishka_gervaz/blob/v0.0.2/lib/mishka_gervaz/table/web/renderer.ex#L1)

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`.

# `first_read_out?`

```elixir
@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.

# `render`

```elixir
@spec render(map()) :: Phoenix.LiveView.Rendered.t()
```

Renders the table through the template currently in effect.

Until the first read returns, the template's `c: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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
