Skip to content

Commit

Permalink
Fix behavior of clicking on domain link (#98410)
Browse files Browse the repository at this point in the history
  • Loading branch information
Imran92 authored Jan 15, 2025
1 parent 6c4f1c8 commit 1bb294a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export function DomainsTableRow( { domain }: DomainsTableRowProps ) {
const domainTypeText =
currentDomainData && getDomainTypeText( currentDomainData, __, domainInfoContext.DOMAIN_ROW );

const isAllDomainManagementEnabled = config.isEnabled( 'calypso/all-domain-management' );

const domainManagementLink = isManageableDomain
? getDomainManagementLink(
domain,
Expand All @@ -105,8 +107,6 @@ export function DomainsTableRow( { domain }: DomainsTableRowProps ) {
};

const handleSelect = () => {
const isAllDomainManagementEnabled = config.isEnabled( 'calypso/all-domain-management' );

if ( isAllDomainManagementEnabled && ( isHostingOverview || isAllSitesView ) ) {
page.show( domainManagementLink );
return;
Expand All @@ -115,6 +115,9 @@ export function DomainsTableRow( { domain }: DomainsTableRowProps ) {
window.location.href = domainManagementLink;
};

const handleDomainLinkClick = ( e: MouseEvent ) =>
isAllDomainManagementEnabled ? e.preventDefault() : e.stopPropagation();

return (
<tr
key={ domain.domain }
Expand Down Expand Up @@ -156,7 +159,7 @@ export function DomainsTableRow( { domain }: DomainsTableRowProps ) {
<a
className="domains-table__domain-name"
href={ domainManagementLink }
onClick={ ( e: MouseEvent ) => e.stopPropagation() }
onClick={ handleDomainLinkClick }
>
{ domain.domain }
</a>
Expand Down

0 comments on commit 1bb294a

Please sign in to comment.