Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inut value reset to empty when select #260

Open
tarun1081998 opened this issue Jun 11, 2023 · 1 comment
Open

inut value reset to empty when select #260

tarun1081998 opened this issue Jun 11, 2023 · 1 comment

Comments

@tarun1081998
Copy link

tarun1081998 commented Jun 11, 2023

Describe the bug
When we are using the getOptions function, it is returning correct dropdown data, but when we select any option, it set the input filed value to right option and then sets it to empty

To Reproduce
Steps to reproduce the behavior:

  1. use getOptions function to call api on query change
  2. on UI editing the input field, it shows the corect dropdown items
  3. select any item
  4. the input field will show it's name and then empties the input field.

Expected behavior
Selected item should be visible in input field

Screenshots
image
image

Desktop (please complete the following information):

  • OS: windows 11
  • Browser chrome

Additional context
Below is my getOptions function
function getOptions(query) { if(query === ''){ return [{name:'',value:''}] } return new Promise((resolve, reject) => { fetch(https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=${query}&apikey={myapikey}`)
.then(response => response.json())
.then((resp) => {
var stocks = resp?.bestMatches?.filter(x=>x["4. region"]==="India/Bombay")
if(stocks)
resolve(stocks?.map(s=>{return {name:s["2. name"],value:s["1. symbol"]}}))
else
resolve([{name:'',value:''}])
})
.catch(reject);
});
}`
bug-compressed.zip

@tarun1081998
Copy link
Author

PR is open for this issue @tbleckert #261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant