Skip to main content

Hi,


I am using Vibe for UI for my app. I am using the dropdown component to list users. It is working well for static data but when it comes to dynamic data I can’t make it. I am querying the backend, getting user results and set the fresh data using react’s useState function. Here is my example.


const nusers, setUsers] = useState(a])

<Dropdown
insideOverflowContainer={true}
className="dropdown-stories-styles_spacing"
options={users}
placeholder="Select users..."
menuPosition={Dropdown.menuPositions.FIXED}
multi
multiline
onKeyDown={function (val) {
SearchUsers(val, setUsers)
}}

import {useEffect} from "react";
import mondaySdk from "monday-sdk-js";

const monday = mondaySdk();
const userTimeouts = s]

export function SearchUsers(el, setUsers) {
let timeout = setTimeout(function () {
let query = `query { users(name: "${el.target.value}"){ id name photo_tiny} }`
let users = s]
monday.api(query).then(res => {
res.data.users.forEach(function (user) {
users.push({label: user.name, value: user.id, leftAvatar: user.photo_tiny})
})
setUsers(users)
})
}, 50)

userTimeouts.forEach(function (timeout) {
clearTimeout(timeout)
});

userTimeouts.push(timeout);
}

What is the wrong here?

Hello there @apsimos,


Would you be able to please fill this form so our team can take a look into this? Please add as much detail about your case as possible.


Looking forward to hearing from you via the form!


Cheers,

Matias


Hi @Matias.Monday,


I had submitted the form.


Cheers


Thank you @apsimos,


See you there!


Reply