Stateful diff helper that keeps numeric id assignments stable.
Summary
Functions
Compute patches for a new tree and return {patch_binary, updated_state, assigned_tree}.
Compute patches for a new tree without constructing a full assigned tree.
Initialize diff state with an optional tree.
Types
@type t() :: %Emerge.Engine.DiffState{ event_registry: %{ required(binary()) => %{required(term()) => {pid(), term()}} }, next_id: non_neg_integer(), tree: Emerge.Engine.Element.t() | nil, vdom: Emerge.Engine.VNode.t() | nil }
Functions
@spec diff_and_encode(t(), Emerge.Engine.Element.t()) :: {binary(), t(), Emerge.Engine.Element.t()}
Compute patches for a new tree and return {patch_binary, updated_state, assigned_tree}.
@spec diff_and_encode_binary(t(), Emerge.Engine.Element.t()) :: {binary(), t()}
Compute patches for a new tree without constructing a full assigned tree.
This is intended for runtime renderer updates that only need the patch binary and next diff state. Insert patches still encode assigned inserted subtrees.
Initialize diff state with an optional tree.