cmdk icon indicating copy to clipboard operation
cmdk copied to clipboard

add better async compatibility

Open jrnxf opened this issue 8 months ago • 5 comments

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

jrnxf avatar Apr 18 '25 10:04 jrnxf

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

vercel[bot] avatar Apr 18 '25 10:04 vercel[bot]

Thanks @jrnxf! I hope we can get the maintainers to look at this sooner rather than later!

jaxxreal avatar Apr 22 '25 13:04 jaxxreal

+1 also dealing with this issue

greg-wolff avatar May 25 '25 23:05 greg-wolff

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.

siimsams avatar Jun 13 '25 17:06 siimsams

@pacocoursey any chance we could get a review on this one? Would love to get this out ❤️

jrnxf avatar Sep 24 '25 23:09 jrnxf