fix re-render of tags component (#16270)

* fix re-render of tags component

* fix cypress data issue

* fix code smell
This commit is contained in:
Karan Hotchandani 2024-05-16 10:17:37 +05:30 committed by GitHub
parent 755a643f6f
commit 448f286ee3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 8 deletions

View File

@ -888,8 +888,8 @@ export const DOMAIN_3 = {
fullyQualifiedName: 'sample_superset.forecast_sales_performance', fullyQualifiedName: 'sample_superset.forecast_sales_performance',
}, },
{ {
name: 'eta_predictions', name: 'fact_sale',
fullyQualifiedName: 'mlflow_svc.eta_predictions', fullyQualifiedName: 'sample_data.ecommerce_db.shopify.fact_sale',
}, },
{ {
name: 'operations_view', name: 'operations_view',
@ -904,8 +904,8 @@ export const DOMAIN_3 = {
fullyQualifiedName: 'sample_superset.forecast_sales_performance', fullyQualifiedName: 'sample_superset.forecast_sales_performance',
}, },
{ {
name: 'eta_predictions', name: 'fact_sale',
fullyQualifiedName: 'mlflow_svc.eta_predictions', fullyQualifiedName: 'sample_data.ecommerce_db.shopify.fact_sale',
}, },
{ {
name: 'operations_view', name: 'operations_view',

View File

@ -766,7 +766,7 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => {
.click(); .click();
checkDisplayName(NEW_GLOSSARY.name); checkDisplayName(NEW_GLOSSARY.name);
addOwner('Aaron Johnson', GLOSSARY_OWNER_LINK_TEST_ID); addOwner('Alex Pollard', GLOSSARY_OWNER_LINK_TEST_ID);
}); });
it('Remove Owner', () => { it('Remove Owner', () => {
@ -775,7 +775,7 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => {
.click(); .click();
checkDisplayName(NEW_GLOSSARY.name); checkDisplayName(NEW_GLOSSARY.name);
removeOwner('Aaron Johnson', GLOSSARY_OWNER_LINK_TEST_ID); removeOwner('Alex Pollard', GLOSSARY_OWNER_LINK_TEST_ID);
}); });
it('Verify and Remove Tags from Glossary', () => { it('Verify and Remove Tags from Glossary', () => {

View File

@ -24,7 +24,14 @@ import {
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { debounce, isEmpty, isUndefined, pick } from 'lodash'; import { debounce, isEmpty, isUndefined, pick } from 'lodash';
import { CustomTagProps } from 'rc-select/lib/BaseSelect'; import { CustomTagProps } from 'rc-select/lib/BaseSelect';
import React, { FC, useCallback, useMemo, useRef, useState } from 'react'; import React, {
FC,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants'; import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants';
import { TAG_START_WITH } from '../../../constants/Tag.constants'; import { TAG_START_WITH } from '../../../constants/Tag.constants';
@ -283,6 +290,10 @@ const AsyncSelectList: FC<AsyncSelectListProps & SelectProps> = ({
onChange?.(selectedValues); onChange?.(selectedValues);
}; };
useEffect(() => {
loadOptions('');
}, []);
return ( return (
<Select <Select
autoFocus autoFocus
@ -297,7 +308,6 @@ const AsyncSelectList: FC<AsyncSelectListProps & SelectProps> = ({
style={{ width: '100%' }} style={{ width: '100%' }}
tagRender={customTagRender} tagRender={customTagRender}
onChange={handleChange} onChange={handleChange}
onFocus={() => loadOptions('')}
onInputKeyDown={(event) => { onInputKeyDown={(event) => {
if (event.key === 'Backspace') { if (event.key === 'Backspace') {
return event.stopPropagation(); return event.stopPropagation();