A keyed render (spec/01 §3.3): a component's render answered as keyed parts, which the
runtime places by key, so a change sends only the rows whose markup changed. The
runtime knows it by its shape alone, never by its module (spec/00 §1, it is generic):
a struct implementing Phoenix.HTML.Safe with
head,gap_before,gap_afterandtail, iodata, placed as they are;rows,[{key, version, markup}]in the order drawn, each key unique within the render,markupiodata,versionwhat the markup reads beyond the render'sscope(nilfor markup never to be reused);scope(optional), what every row's markup reads besides.
Flattened (Phoenix.HTML.Safe.to_iodata/1), it is the head, the gap before, each row's
markup in order, the gap after and the tail. macaw's built-in table answers one
(Rows, macaw#434).
Summary
Types
The rows a runtime holds for a keyed render, as macaw_component's held assign takes
them (its spec/02 §1.2): each row's markup, one binary, by the render's scope and the
row's version.
A keyed render: a struct of the shape above.
Functions
The bytes of markup the keyed render flattens to.
The rows a page keeps beside a cell after placing keyed (spec/01 §3.4), from those it
kept before: each row with a version under the render's scope, its markup the binary
written. A row kept already holds costs a lookup and changes nothing, so a render
whose every row was held (a sort, an equal refetch) answers kept itself; new rows are
added; past four times the rows placed (at least 1,000 entries) it starts again from
the rows just placed. nil for a render with no scope, or something not keyed.
Whether term is a keyed render, by its shape: usable in a guard.
The keyed render with each part, and each row's markup, written out to a binary of its own.
Types
The rows a runtime holds for a keyed render, as macaw_component's held assign takes
them (its spec/02 §1.2): each row's markup, one binary, by the render's scope and the
row's version.
@type t() :: %{ :__struct__ => module(), :head => iodata(), :gap_before => iodata(), :rows => [{term(), term(), iodata()}], :gap_after => iodata(), :tail => iodata(), optional(atom()) => term() }
A keyed render: a struct of the shape above.
Functions
@spec bytes(t()) :: non_neg_integer()
The bytes of markup the keyed render flattens to.
The rows a page keeps beside a cell after placing keyed (spec/01 §3.4), from those it
kept before: each row with a version under the render's scope, its markup the binary
written. A row kept already holds costs a lookup and changes nothing, so a render
whose every row was held (a sort, an equal refetch) answers kept itself; new rows are
added; past four times the rows placed (at least 1,000 entries) it starts again from
the rows just placed. nil for a render with no scope, or something not keyed.
Whether term is a keyed render, by its shape: usable in a guard.
The keyed render with each part, and each row's markup, written out to a binary of its own.