admin(ui): SearchableSelect - differentiate between loading and no items
This commit is contained in:
parent
224943cc85
commit
dc003a6ada
3 changed files with 11 additions and 11 deletions
|
@ -8,7 +8,7 @@ export default ({ selected }: { selected: Database | null }) => {
|
|||
const context = useFormikContext();
|
||||
|
||||
const [ database, setDatabase ] = useState<Database | null>(selected);
|
||||
const [ databases, setDatabases ] = useState<Database[]>([]);
|
||||
const [ databases, setDatabases ] = useState<Database[] | null>(null);
|
||||
|
||||
const onSearch = (query: string): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -40,7 +40,7 @@ export default ({ selected }: { selected: Database | null }) => {
|
|||
getSelectedText={getSelectedText}
|
||||
nullable
|
||||
>
|
||||
{databases.map(d => (
|
||||
{databases?.map(d => (
|
||||
<Option key={d.id} selectId="database" id={d.id} item={d} active={d.id === database?.id}>
|
||||
{d.name}
|
||||
</Option>
|
||||
|
|
|
@ -8,7 +8,7 @@ export default ({ selected }: { selected: Location | null }) => {
|
|||
const context = useFormikContext();
|
||||
|
||||
const [ location, setLocation ] = useState<Location | null>(selected);
|
||||
const [ locations, setLocations ] = useState<Location[]>([]);
|
||||
const [ locations, setLocations ] = useState<Location[] | null>(null);
|
||||
|
||||
const onSearch = (query: string): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -40,7 +40,7 @@ export default ({ selected }: { selected: Location | null }) => {
|
|||
getSelectedText={getSelectedText}
|
||||
nullable
|
||||
>
|
||||
{locations.map(d => (
|
||||
{locations?.map(d => (
|
||||
<Option key={d.id} selectId="location" id={d.id} item={d} active={d.id === location?.id}>
|
||||
{d.short}
|
||||
</Option>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue