|
|
|
|
@ -2,7 +2,7 @@ import React, { useMemo, useRef, useState, useEffect } from 'react';
|
|
|
|
|
import { Select, Spin } from 'antd';
|
|
|
|
|
import { debounce, objectMapper } from '@/utils/commons';
|
|
|
|
|
|
|
|
|
|
function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false, defaultOptions=[], ...props }) {
|
|
|
|
|
function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false, defaultOptions=[], onFetch=null, ...props }) {
|
|
|
|
|
const [fetching, setFetching] = useState(false);
|
|
|
|
|
const [options, setOptions] = useState([]);
|
|
|
|
|
const fetchRef = useRef(0);
|
|
|
|
|
@ -28,7 +28,7 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false,
|
|
|
|
|
}
|
|
|
|
|
setOptions(mapperOptions);
|
|
|
|
|
setFetching(false);
|
|
|
|
|
props.onFetch && props.onFetch(mapperOptions);
|
|
|
|
|
onFetch && onFetch(mapperOptions);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|