[Bug] The List scrolls to a stale top item when search changes
When you change the search search string and this change makes more search results then the list scrolls to the previous top item instead of the current one.
I suppose it happens because store.setState('search', props.value) is followed by scrollSelectedIntoView... and inside getSelectedItem search for [aria-selected="true"] in not yet updated dom.
When the search string is changed from cc to cccc - the new top item is "Cascade Interactive" When the search is changed back from cccc to cc - the new top item is "Echo Networks" and it is selected BUT List scrolls to Cascade Interactive
https://github.com/user-attachments/assets/f7837b05-dbc1-44ab-b9ea-49cf5549a6b5
here is a test data
const organizations = [ { id: 1, name: "Acme Innovations" }, { id: 2, name: "BlueSky Technologies" }, { id: 3, name: "Quantum Dynamics" }, { id: 4, name: "Aurora Systems" }, { id: 5, name: "Nimbus Labs" }, { id: 6, name: "Vertex Analytics" }, { id: 7, name: "Solaris Consulting" }, { id: 8, name: "Evergreen Solutions" }, { id: 9, name: "Summit Digital" }, { id: 10, name: "Atlas Ventures" }, { id: 11, name: "NeonSoft" }, { id: 12, name: "CorePulse" }, { id: 13, name: "Zenith Global" }, { id: 14, name: "Ironclad Industries" }, { id: 15, name: "Frontier Robotics" }, { id: 16, name: "Lighthouse Data" }, { id: 17, name: "Horizon Partners" }, { id: 18, name: "NextGen BioWorks" }, { id: 19, name: "Cascade Interactive" }, { id: 20, name: "Echo Networks" }, { id: 21, name: "Velocity Ventures" }, { id: 22, name: "PolarEdge" }, { id: 23, name: "SummitOne Group" }, { id: 24, name: "Cobalt Consulting" }, { id: 25, name: "Helix Cloud" }, { id: 26, name: "NovaLink Systems" }, { id: 27, name: "TrueNorth Media" }, { id: 28, name: "BrightPath AI" }, { id: 29, name: "EchoBase Security" }, { id: 30, name: "TerraWorks" }, ];
Source: dip/cmdk