pub fn reconcile_element<A: 'static>(
tree: &mut ElementTree<A>,
runtime: &RuntimeHandle<A>,
element_id: ElementId,
new_view: View<A>,
) -> ElementIdExpand description
Reconciles new_view into an existing element and returns the same ID.
The element’s kind, key, and view metadata are replaced. Layout is always
invalidated with a nonzero wrapping revision, even if inputs are equal.
Widgets use their declarative children; components build exactly once and
retain the built view as one child. Reused descendants are selected by
reconcile_children; removed subtrees also lose tree-scoped state.
If element_id is missing, metadata update is a no-op but child creation can
still occur with that missing ID as parent; callers should only pass IDs
owned by tree. Component/widget panics propagate without rollback.
§Examples
use ailloli_ui_runtime::app::RuntimeHandle;
use ailloli_ui_runtime::component::View;
use ailloli_ui_runtime::element::{ElementKind, ElementTree};
use ailloli_ui_runtime::element::reconcile::reconcile_element;
let runtime = RuntimeHandle::<()>::new();
let mut tree = ElementTree::new();
let id = tree.create_element(ElementKind::Empty, None, None);
assert_eq!(reconcile_element(&mut tree, &runtime, id, View::empty()), id);
assert!(tree.get(id).unwrap().dirty.layout);