chore: Select component refactoring - SelectAsyncControl - Iteration 5 (#16609)

* Refactor Select

* Implement onError

* Separate async request

* Lint

* Allow clear

* Improve type

* Reconcile with Select latest changes

* Fix handleOnChange

* Clean up

* Add placeholder

* Accept null values

* Update superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>

* Clean up

* Implement type guard

* Fix lint

* Catch error within loadOptions

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>
This commit is contained in:
Geido
2021-10-07 14:20:32 +03:00
committed by GitHub
parent 5fc9970079
commit a782a62097
4 changed files with 127 additions and 113 deletions

View File

@@ -93,6 +93,7 @@ export interface SelectProps extends PickedSelectProps {
pageSize?: number;
invertSelection?: boolean;
fetchOnlyOnSearch?: boolean;
onError?: (error: string) => void;
}
const StyledContainer = styled.div`
@@ -331,6 +332,10 @@ const Select = ({
getClientErrorObject(response).then(e => {
const { error } = e;
setError(error);
if (props.onError) {
props.onError(error);
}
});
const handleData = (data: OptionsType) => {