mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: alert modal bug fix (#22688)
This commit is contained in:
parent
cf00970cde
commit
5a422b31c5
@ -194,18 +194,8 @@ const AsyncSelect = forwardRef(
|
|||||||
[sortComparator, sortSelectedFirst],
|
[sortComparator, sortSelectedFirst],
|
||||||
);
|
);
|
||||||
|
|
||||||
const initialOptions = useMemo(
|
|
||||||
() =>
|
|
||||||
options && Array.isArray(options) ? options.slice() : EMPTY_OPTIONS,
|
|
||||||
[options],
|
|
||||||
);
|
|
||||||
const initialOptionsSorted = useMemo(
|
|
||||||
() => initialOptions.slice().sort(sortComparatorForNoSearch),
|
|
||||||
[initialOptions, sortComparatorForNoSearch],
|
|
||||||
);
|
|
||||||
|
|
||||||
const [selectOptions, setSelectOptions] =
|
const [selectOptions, setSelectOptions] =
|
||||||
useState<SelectOptionsType>(initialOptionsSorted);
|
useState<SelectOptionsType>(EMPTY_OPTIONS);
|
||||||
|
|
||||||
// add selected values to options list if they are not in it
|
// add selected values to options list if they are not in it
|
||||||
const fullSelectOptions = useMemo(() => {
|
const fullSelectOptions = useMemo(() => {
|
||||||
@ -441,8 +431,8 @@ const AsyncSelect = forwardRef(
|
|||||||
// when `options` list is updated from component prop, reset states
|
// when `options` list is updated from component prop, reset states
|
||||||
fetchedQueries.current.clear();
|
fetchedQueries.current.clear();
|
||||||
setAllValuesLoaded(false);
|
setAllValuesLoaded(false);
|
||||||
setSelectOptions(initialOptions);
|
setSelectOptions(EMPTY_OPTIONS);
|
||||||
}, [initialOptions]);
|
}, [options]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectValue(value);
|
setSelectValue(value);
|
||||||
|
Loading…
Reference in New Issue
Block a user