Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion client/dashboard/domains/dataviews/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ export const useActions = ( { user, sites }: { user: User; sites?: Site[] } ) =>
isEligible: ( item: DomainSummary ) => {
const site = sitesByBlogId[ item.blog_id ];
return (
!! site && ! site?.is_wpcom_atomic && item.subtype.id === DomainSubtype.DEFAULT_ADDRESS
!! site &&
! site?.is_wpcom_atomic &&
! site?.is_garden &&
item.subtype.id === DomainSubtype.DEFAULT_ADDRESS
);
},
RenderModal: ( { items, closeModal = noop } ) => {
Expand Down
7 changes: 6 additions & 1 deletion client/dashboard/sites/domains/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ function SiteDomains() {
fields
);

// Hide actions column when no domain has eligible actions.
const hasEligibleActions = filteredData?.some( ( item ) =>
actions.some( ( action ) => action.isEligible === undefined || action.isEligible( item ) )
);
Comment on lines +64 to +66
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

I think this should use siteDomains, not filteredData. Doing the check post-filtering means that the actions column will appear and disappear as the user types in the search field, or as the user clicks between pages. I think the presence of the column should be more stable, and so it should run over all the domain data.


return (
<PageLayout
header={ <PageHeader title={ __( 'Domains' ) } actions={ <AddDomainButton /> } /> }
Expand Down Expand Up @@ -94,7 +99,7 @@ function SiteDomains() {
onChangeView={ updateView }
onResetView={ resetView }
view={ view }
actions={ actions }
actions={ hasEligibleActions ? actions : [] }
search
paginationInfo={ paginationInfo }
getItemId={ getDomainId }
Expand Down
Loading