Commit a0f3d52
perf(Collection): replace indexOf sort with node index map in getItems (#2695)
* perf(Collection): replace indexOf sort with node index map in getItems
getItems() sorted registered items into DOM order using Array.indexOf
inside the sort comparator, scanning orderedNodes on every comparison
(O(n² log n)). Build a node→index Map once and sort by lookup instead,
giving O(n log n) with two O(n) passes — identical output.
The `?? -1` fallback preserves prior behavior for items whose ref is not
in the DOM query result (indexOf returned -1, sorting them first).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: allow "ba" typeahead fixture in typos config
The whole-repo typos scan flags the "BA"/"ba" typeahead search
fixtures in useTypeahead.test.ts as a misspelling of "by"/"be".
Allowlist "ba" in extend-words (case-insensitive, covers "BA" too),
mirroring the existing "Januar" entry.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9a87083 commit a0f3d52
2 files changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
0 commit comments