tbleckert / react-select-search

⚡️ Lightweight select component for React
https://react-select-search.com
MIT License
676 stars 149 forks source link

Fix async search clicks #108

Closed davidangel closed 3 years ago

davidangel commented 3 years ago

Addresses #107 (and I believe #92 - unsure why this didn't get merged?)

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tbleckert/react-select-search/2gs8izvhm
✅ Preview: https://react-select-search-git-fork-davidangel-master.tbleckert.vercel.app

davidangel commented 3 years ago

Upon further testing, I'm not convinced my current changes actually fix anything.

It looks like there's no ID making it to this line, and thus no selection taking place. Is one expected to provide the value attribute on the button?

tbleckert commented 3 years ago

@davidangel Sorry for the delay and thanks for the PR. From what I can tell, your fix seems to fix the issue.

Regarding your comment. Yes, a value is needed on the option element. It is included in the DOM props sent to the render callback (https://github.com/tbleckert/react-select-search/blob/master/src/Components/Option.jsx#L20).

I think the problems came with the introduction of number support for values. In the linked file you can see that I set _id instead of value in your commit, that gives a hint about the problem.

I'll merge this in and prepare it for testing and a patch release.