AshUi.Render (ash_ui v0.1.0)

Copy Markdown View Source

Builds %AshUi.Rendered{} structures straight from a compiled patch table — statics from the table's skeleton, dynamics from evaluator closures over the CURRENT record. The neutral differential contract uses nil-based change tracking: a dynamic whose address is not in the changed set (AshUi.Patch.Runtime.changed_addresses/3) returns nil, and the AshUi.Diff kernel decides the minimal keyed patch. This is the ONE runtime emission path — transports convert or diff its output, never re-emit.

Keyed lists use the core render algebra's keyed comprehensions. Entry keys implement Ash resource identity (AshUi.Patch.Keys — authored key: expression, else the FULL primary key). Entry vars carry the item, the ordinal position when the template declares an index, and the parent record fields the item template reads (:__parent__) — the kernel's retained-variable comparison invalidates exactly the rows a move, item change, or parent-field change touches.

Event binding keys thread through scopes as :__bp_binding_chain__ in scope context: item boundaries append the entry key component, child boundaries append the child address component — producing exactly the keys AshUi.Patch.Bindings.resolve/3 accepts.

Summary

Functions

Build the root Rendered for record from its resource's patch table.

Functions

build(record, changed, opts \\ [])

@spec build(struct(), :all | MapSet.t(), keyword()) :: AshUi.Rendered.t() | struct()

Build the root Rendered for record from its resource's patch table.

changed is :all (mount / unknown before-image) or the address set from AshUi.Patch.Runtime.changed_addresses/3.

Options: :actor, :tenant, :params (scope inputs — the staged evaluation of the view calculation runs under the same scope the calculation would), :view.