ENCOA-316 ENCOA-317:
Refactor components to remove Layout wrapper and pass it in the App component , implemented a skeleton feedback while loading page and improved API calls related to Dashboard/User Profile
This commit is contained in:
@@ -48,6 +48,15 @@ export default function AsyncSelect({
|
||||
flat,
|
||||
}: Props & (MultiProps | SingleProps)) {
|
||||
const [target, setTarget] = useState<HTMLElement>();
|
||||
const [inputValue, setInputValue] = useState("");
|
||||
|
||||
//Implemented a debounce to prevent the API from being called too frequently
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
loadOptions(inputValue);
|
||||
}, 200);
|
||||
return () => clearTimeout(timer);
|
||||
}, [inputValue, loadOptions]);
|
||||
|
||||
useEffect(() => {
|
||||
if (document) setTarget(document.body);
|
||||
@@ -77,7 +86,7 @@ export default function AsyncSelect({
|
||||
filterOption={null}
|
||||
loadingMessage={() => "Loading..."}
|
||||
onInputChange={(inputValue) => {
|
||||
loadOptions(inputValue);
|
||||
setInputValue(inputValue);
|
||||
}}
|
||||
options={options}
|
||||
value={value}
|
||||
|
||||
Reference in New Issue
Block a user