MINOR: fix the dropdown not showing in case of no data in glossary (#16256)

* fix the dropdown not showing in case of no data in glossary

* minor fix
This commit is contained in:
Ashish Gupta 2024-05-16 14:27:56 +05:30 committed by GitHub
parent c3abcc22b6
commit fc00b61e59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,6 +73,7 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
const form = Form.useFormInstance(); const form = Form.useFormInstance();
const fetchGlossaryListInternal = async () => { const fetchGlossaryListInternal = async () => {
setIsLoading(true);
try { try {
const { data } = await getGlossariesList({ const { data } = await getGlossariesList({
limit: PAGE_SIZE_LARGE, limit: PAGE_SIZE_LARGE,
@ -91,11 +92,12 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
const dropdownRender = (menu: React.ReactElement) => ( const dropdownRender = (menu: React.ReactElement) => (
<> <>
{menu} {isLoading ? <Loader size="small" /> : menu}
<Space className="p-sm p-b-xss p-l-xs custom-dropdown-render" size={8}> <Space className="p-sm p-b-xss p-l-xs custom-dropdown-render" size={8}>
<Button <Button
className="update-btn" className="update-btn"
data-testid="saveAssociatedTag" data-testid="saveAssociatedTag"
disabled={isEmpty(glossaries)}
htmlType="submit" htmlType="submit"
loading={isSubmitLoading} loading={isSubmitLoading}
size="small" size="small"
@ -211,7 +213,6 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
if (!params?.glossary) { if (!params?.glossary) {
return; return;
} }
setIsLoading(true);
try { try {
const results = await queryGlossaryTerms(params.glossary); const results = await queryGlossaryTerms(params.glossary);
@ -229,8 +230,6 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
); );
} catch (error) { } catch (error) {
showErrorToast(error as AxiosError); showErrorToast(error as AxiosError);
} finally {
setIsLoading(false);
} }
}; };
@ -282,7 +281,6 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
return Promise.resolve(); return Promise.resolve();
}} }}
notFoundContent={isLoading ? <Loader size="small" /> : null}
showCheckedStrategy={TreeSelect.SHOW_ALL} showCheckedStrategy={TreeSelect.SHOW_ALL}
style={{ width: '100%' }} style={{ width: '100%' }}
switcherIcon={ switcherIcon={