mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-07 02:51:41 +00:00
* fix(collab): place keyed-list puts through an index within a batch Each Put of a comment, style, variable or collection scanned the whole list for its key (cloning String keys on the way) before appending, so a batch of N new entries cost N squared comparisons on the hub every session shares. Removing an image also rebuilt the document's image-use set before checking the image existed. Replica::apply now keeps a per-batch key index for each keyed list; it is rebuilt when the list's length or the entry at a key no longer matches, and dropped on whole-list sets, reorders and real removals. Removing an absent entry or image returns without scanning. * fix(collab): keep the keyed-list index current through removals Build the index without dead code outside tests, drop the wall-clock assertion from the large-batch test, and shift the index down after a single-entry removal instead of discarding it, so a run of removals in one batch does not index the list again each time. Staleness checks for puts and removals share one helper. Tests cover removals, duplicate keys from a whole-list set, and absent keys.