Merge branch 'suspense' into 'main'

Suspense

See merge request soapbox-pub/soapbox!2782
This commit is contained in:
Alex Gleason 2023-10-08 04:03:08 +00:00
commit 401fcbd1b3
4 changed files with 21 additions and 8 deletions

View file

@ -1,5 +1,5 @@
import clsx from 'clsx'; import clsx from 'clsx';
import React from 'react'; import React, { Suspense } from 'react';
import StickyBox from 'react-sticky-box'; import StickyBox from 'react-sticky-box';
interface ISidebar { interface ISidebar {
@ -52,7 +52,9 @@ const Main: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({ children, classN
const Aside: React.FC<IAside> = ({ children }) => ( const Aside: React.FC<IAside> = ({ children }) => (
<aside className='hidden xl:col-span-3 xl:block'> <aside className='hidden xl:col-span-3 xl:block'>
<StickyBox offsetTop={80} className='space-y-6 pb-12'> <StickyBox offsetTop={80} className='space-y-6 pb-12'>
{children} <Suspense>
{children}
</Suspense>
</StickyBox> </StickyBox>
</aside> </aside>
); );

View file

@ -1,5 +1,5 @@
import noop from 'lodash/noop'; import noop from 'lodash/noop';
import React from 'react'; import React, { Suspense } from 'react';
import { toggleStatusReport } from 'soapbox/actions/reports'; import { toggleStatusReport } from 'soapbox/actions/reports';
import StatusContent from 'soapbox/components/status-content'; import StatusContent from 'soapbox/components/status-content';
@ -73,7 +73,7 @@ const StatusCheckBox: React.FC<IStatusCheckBox> = ({ id, disabled }) => {
<div className='status-check-box'> <div className='status-check-box'>
<div className='status-check-box__status'> <div className='status-check-box__status'>
<StatusContent status={status} /> <StatusContent status={status} />
{media} <Suspense>{media}</Suspense>
</div> </div>
<div className='status-check-box-toggle'> <div className='status-check-box-toggle'>

View file

@ -515,7 +515,9 @@ const UI: React.FC<IUI> = ({ children }) => {
<ProfileHoverCard /> <ProfileHoverCard />
</Suspense> </Suspense>
<StatusHoverCard /> <Suspense>
<StatusHoverCard />
</Suspense>
</div> </div>
</div> </div>
</GlobalHotkeys> </GlobalHotkeys>

View file

@ -76,15 +76,24 @@ const SoapboxMount = () => {
<Switch> <Switch>
<Route <Route
path='/embed/:statusId' path='/embed/:statusId'
render={(props) => <EmbeddedStatus params={props.match.params} />} render={(props) => (
<Suspense>
<EmbeddedStatus params={props.match.params} />
</Suspense>
)}
/> />
<Redirect from='/@:username/:statusId/embed' to='/embed/:statusId' /> <Redirect from='/@:username/:statusId/embed' to='/embed/:statusId' />
<Route> <Route>
{renderBody()} {renderBody()}
<ModalContainer /> <Suspense>
<GdprBanner /> <ModalContainer />
</Suspense>
<Suspense>
<GdprBanner />
</Suspense>
<div id='toaster'> <div id='toaster'>
<Toaster <Toaster