Skip to content

Commit d76cc6d

Browse files
committed
Use AsyncLoad to fix type error
1 parent c7d9293 commit d76cc6d

File tree

3 files changed

+26
-33
lines changed

3 files changed

+26
-33
lines changed

client/sites/components/sites-dataviews/actions.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import { sprintf } from '@wordpress/i18n';
1111
import { drawerLeft, external, wordpress } from '@wordpress/icons';
1212
import { useI18n } from '@wordpress/react-i18n';
1313
import { addQueryArgs } from '@wordpress/url';
14-
import { Suspense, useMemo } from 'react';
14+
import { useMemo } from 'react';
15+
import AsyncLoad from 'calypso/components/async-load';
1516
import { USE_SITE_EXCERPTS_QUERY_KEY } from 'calypso/data/sites/use-site-excerpts-query';
1617
import useRestoreSiteMutation from 'calypso/sites/hooks/use-restore-site-mutation';
17-
import { LazyLeaveSiteModalForm } from 'calypso/sites/settings/administration/tools/leave-site';
1818
import {
1919
getAdminInterface,
2020
getPluginsUrl,
@@ -521,23 +521,23 @@ export function useActions( {
521521
isEligible: isActionEligible( 'leave-site', capabilities ),
522522
RenderModal: ( { items, closeModal }: RenderModalProps< SiteExcerptData > ) => {
523523
return (
524-
<Suspense>
525-
<LazyLeaveSiteModalForm
526-
siteId={ items[ 0 ]?.ID ?? 0 }
527-
onSuccess={ () => {
528-
queryClient.invalidateQueries( {
529-
queryKey: [
530-
USE_SITE_EXCERPTS_QUERY_KEY,
531-
SITE_EXCERPT_REQUEST_FIELDS,
532-
SITE_EXCERPT_REQUEST_OPTIONS,
533-
[],
534-
'all',
535-
],
536-
} );
537-
} }
538-
onClose={ closeModal }
539-
/>
540-
</Suspense>
524+
<AsyncLoad
525+
require="calypso/sites/settings/administration/tools/leave-site/leave-site-form"
526+
placeholder={ null }
527+
siteId={ items[ 0 ]?.ID ?? 0 }
528+
onSuccess={ () => {
529+
queryClient.invalidateQueries( {
530+
queryKey: [
531+
USE_SITE_EXCERPTS_QUERY_KEY,
532+
SITE_EXCERPT_REQUEST_FIELDS,
533+
SITE_EXCERPT_REQUEST_OPTIONS,
534+
[],
535+
'all',
536+
],
537+
} );
538+
} }
539+
onClose={ closeModal }
540+
/>
541541
);
542542
},
543543
modalSize: 'small',

client/sites/settings/administration/tools/index.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { addQueryArgs } from '@wordpress/url';
22
import { localize, fixMe } from 'i18n-calypso';
3-
import { Component, Suspense } from 'react';
3+
import { Component } from 'react';
44
import { connect } from 'react-redux';
5+
import AsyncLoad from 'calypso/components/async-load';
56
import QueryRewindState from 'calypso/components/data/query-rewind-state';
67
import { withSiteCopy } from 'calypso/landing/stepper/hooks/use-site-copy';
78
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
89
import SettingsSectionHeader from 'calypso/my-sites/site-settings/settings-section-header';
9-
import { LazyLeaveSiteModal } from 'calypso/sites/settings/administration/tools/leave-site';
1010
import { errorNotice, successNotice } from 'calypso/state/notices/actions';
1111
import {
1212
hasLoadedSitePurchasesFromServer,
@@ -181,19 +181,21 @@ class SiteTools extends Component {
181181
) }
182182

183183
{ showLeaveSite && (
184-
<Suspense>
184+
<>
185185
<AdministrationToolCard
186186
title={ translate( 'Leave site' ) }
187187
description={ translate( 'Leave this site and remove your access.' ) }
188188
onClick={ this.handleOpenModal( MODAL_NAMES.LEAVE_SITE ) }
189189
/>
190190
{ modalOpen[ MODAL_NAMES.LEAVE_SITE ] && (
191-
<LazyLeaveSiteModal
191+
<AsyncLoad
192+
require="calypso/sites/settings/administration/tools/leave-site/leave-site-modal"
193+
placeholder={ null }
192194
siteId={ siteId }
193195
onClose={ this.handleCloseModal( MODAL_NAMES.LEAVE_SITE ) }
194196
/>
195197
) }
196-
</Suspense>
198+
</>
197199
) }
198200

199201
{ showDeleteContent && (

client/sites/settings/administration/tools/leave-site/index.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)