@@ -14,7 +14,6 @@ import type { Organization } from "api/typesGenerated";
14
14
import { Avatar } from "components/Avatar/Avatar" ;
15
15
import { AvatarData } from "components/AvatarData/AvatarData" ;
16
16
import { useDebouncedFunction } from "hooks/debounce" ;
17
- // import { prepareQuery } from "utils/filters";
18
17
19
18
export type OrganizationAutocompleteProps = {
20
19
value :Organization | null ;
@@ -38,14 +37,6 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
38
37
value :value ?. name ?? "" ,
39
38
open :false ,
40
39
} ) ;
41
- // const usersQuery = useQuery({
42
- // ...users({
43
- // q: prepareQuery(encodeURI(autoComplete.value)),
44
- // limit: 25,
45
- // }),
46
- // enabled: autoComplete.open,
47
- // keepPreviousData: true,
48
- // });
49
40
const organizationsQuery = useQuery ( organizations ( ) ) ;
50
41
51
42
const { debounced :debouncedInputOnChange } = useDebouncedFunction (
@@ -60,10 +51,8 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
60
51
61
52
return (
62
53
< Autocomplete
63
- // Since the values are filtered by the API we don't need to filter them
64
- // in the FE because it can causes some mismatches.
65
54
filterOptions = { ( organization ) => organization }
66
- noOptionsText = "Nousers found"
55
+ noOptionsText = "Noorganizations found"
67
56
className = { className }
68
57
options = { organizationsQuery . data ?? [ ] }
69
58
loading = { organizationsQuery . isLoading }
@@ -88,14 +77,14 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
88
77
isOptionEqualToValue = { ( option :Organization , value :Organization ) =>
89
78
option . name === value . name
90
79
}
91
- getOptionLabel = { ( option ) => option . name }
80
+ getOptionLabel = { ( option ) => option . display_name }
92
81
renderOption = { ( props , option ) => {
93
82
const { key, ...optionProps } = props ;
94
83
return (
95
84
< li key = { key } { ...optionProps } >
96
85
< AvatarData
97
- title = { option . name }
98
- subtitle = { option . display_name }
86
+ title = { option . display_name }
87
+ subtitle = { option . name }
99
88
src = { option . icon }
100
89
/>
101
90
</ li >
@@ -107,12 +96,14 @@ export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
107
96
fullWidth
108
97
size = { size }
109
98
label = { label }
99
+ autoFocus
110
100
placeholder = "Organization name"
111
101
css = { {
112
102
"&:not(:has(label))" :{
113
103
margin :0 ,
114
104
} ,
115
105
} }
106
+ required
116
107
InputProps = { {
117
108
...params . InputProps ,
118
109
onChange :debouncedInputOnChange ,