#ComboboxItem value property never used

3 messages · Page 1 of 1 (latest)

vital mica
#

I'm using a simple autocomplete component, and passing an array of {value, label} objects but on change the value is never returned, looking at the docs seems like there is no way to obtain it other them implementing a custom combobox.... is this true?

type SimpleProjectSelectProps = {
    value: string;
    onChange: (arg0: string) => void
} | any;

export function SimpleProjectSelect({ value, onChange, ...props }: SimpleProjectSelectProps) {
    const reload = useRef(Math.floor(1000 + Math.random() * 9000));
    const { settings } = useContext(SettingsContext);
    const [{ data: projects, loading, error: pError }] = useAxios<Project[]>(
        `${settings.localBackend}/projects/list?_=${reload.current}`
    );

    return (<Autocomplete
        label="Project"
        limit={15}
        loading={loading}
        value={value}
        onChange={(a,b)=>{console.log(a,b);onChange(a)}}
        data={projects?.map(p => ({ value: p.uuid, label: p.name }))}
        {...props}
    />)
}

vital mica