mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user