Implement commitMutations for insert/move/remove effects in tree order

Adds commitMutations function to reconcile.ts that processes fiber effects
in correct order: removes (reverse), inserts+moves (left-to-right with
insertBefore), updates (top-down). Integrates key-based reconciliation
pipeline into render() via reconcileNode, resolveUNode, and
createFiberForInsert.
This commit is contained in:
2026-05-18 17:17:28 +00:00
parent 9e5b901efc
commit 1e0abb0900
5 changed files with 656 additions and 13 deletions

View File

@@ -133,15 +133,14 @@ describe("Root.render() re-renderable", () => {
expect(emCall!.nextProps.size).toBe("small");
});
it("excess old children remain when new children are fewer", () => {
it("excess old children are removed when new children are fewer", () => {
const { host, instances } = makeHost();
const root = createHostRoot(host, {});
root.render(h("div", null, h("span", null), h("em", null)));
const countAfterFirst = instances.length;
root.render(h("div", null, h("span", null)));
expect(instances.length).toBe(countAfterFirst);
expect(root.rootFiber!.children[0]!.children.length).toBe(2);
expect(root.rootFiber!.children[0]!.children.length).toBe(1);
expect(root.rootFiber!.children[0]!.children[0]!.tag).toBe("span");
});
it("text node props are reconciled on re-render", () => {