fix domain cypress and not found after delete issue (#13450)

This commit is contained in:
Ashish Gupta 2023-10-05 22:59:02 +05:30 committed by GitHub
parent 11b034231a
commit 859a594429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -379,7 +379,7 @@ const DomainDetailsPage = ({
entity: t('label.domain'), entity: t('label.domain'),
})} })}
icon={<StyleIcon color={DE_ACTIVE_COLOR} width="18px" />} icon={<StyleIcon color={DE_ACTIVE_COLOR} width="18px" />}
id="rename-button" id="edit-style-button"
name={t('label.style')} name={t('label.style')}
/> />
), ),

View File

@ -43,7 +43,8 @@ const DomainPage = () => {
const { fqn } = useParams<{ fqn: string }>(); const { fqn } = useParams<{ fqn: string }>();
const history = useHistory(); const history = useHistory();
const { permissions } = usePermissionProvider(); const { permissions } = usePermissionProvider();
const { domains, refreshDomains, updateDomains } = useDomainProvider(); const { domains, refreshDomains, updateDomains, domainLoading } =
useDomainProvider();
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [isMainContentLoading, setIsMainContentLoading] = useState(true); const [isMainContentLoading, setIsMainContentLoading] = useState(true);
const [activeDomain, setActiveDomain] = useState<Domain>(); const [activeDomain, setActiveDomain] = useState<Domain>();
@ -114,8 +115,8 @@ const DomainPage = () => {
? getDomainPath(updatedDomains[0].fullyQualifiedName) ? getDomainPath(updatedDomains[0].fullyQualifiedName)
: getDomainPath(); : getDomainPath();
history.push(domainPath);
refreshDomains(); refreshDomains();
history.push(domainPath);
}) })
.catch((err: AxiosError) => { .catch((err: AxiosError) => {
showErrorToast( showErrorToast(
@ -144,13 +145,13 @@ const DomainPage = () => {
}; };
useEffect(() => { useEffect(() => {
if (domainFqn) { if (domainFqn && domains.length > 0) {
fetchDomainByName(domainFqn); fetchDomainByName(domainFqn);
} }
}, [domainFqn]); }, [domainFqn, domains]);
useEffect(() => { useEffect(() => {
if (domains.length > 0 && !domainFqn) { if (domains.length > 0 && !domainFqn && !domainLoading) {
history.push(getDomainPath(domains[0].fullyQualifiedName)); history.push(getDomainPath(domains[0].fullyQualifiedName));
} }
}, [domains, domainFqn]); }, [domains, domainFqn]);