mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-14 04:13:46 +02:00
admin(ui): SearchableSelect - differentiate between loading and no items
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user