Browse Source
filterTree copied every matched branch node, so filtering a tree where nothing changed still returned new branch objects. The previous implementation used Array#filter, which keeps element references, so callers could rely on filterTree(input, () => true)[0] === input[0]. Branch nodes are now shallow-copied only when their child sequence actually changes; unchanged nodes are returned by reference, restoring the reference semantics callers had before. The mutation fix itself is unaffected: the filtered child array is never assigned back onto the source node.pull/8370/head
2 changed files with 52 additions and 4 deletions
Loading…
Reference in new issue