Commit 230c1c6
Fix: avoid duplicate sort in initiallyFocusedKey computation
Replace the full array sort in the useState initializer with a linear
scan that finds the minimum selected item using the comparator directly.
This eliminates the duplicate sort while keeping initiallyFocusedKey
stable across re-renders (no search-clear scroll bug).
Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>1 parent b797082 commit 230c1c6
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
0 commit comments