add better async compatibility
As mentioned in #280, when dealing with asynchronous fetching and a dynamic list of options, the first item is not always selected an you'd expect. Additionally, as you start typing and update your query, even though the data fetching is async, the selected item jumps to the top (instead of staying where it is), the async options update, and the first item is not highlighted.
If the overall change is acceptable I'll update the README and get everything polished.
Here's a before and after:
Before:
https://github.com/user-attachments/assets/6e7fb73b-be11-49b6-858b-c54bcd0fa515
After:
https://github.com/user-attachments/assets/6c4d9ddc-5ddb-4579-a928-6be243ad095b
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated (UTC) |
|---|---|---|---|
| cmdk-website | ✅ Ready (Inspect) | Visit Preview | Apr 18, 2025 10:14am |
Thanks @jrnxf! I hope we can get the maintainers to look at this sooner rather than later!
+1 also dealing with this issue
What a legend! 👏
@pacocoursey does this need some input?
EDIT: Forked your fix and I'm using it now. Would like to see some feedback on this so we could get this merged. I think this would be beneficial for everybody.
@pacocoursey any chance we could get a review on this one? Would love to get this out ❤️