SoapboxMount: fix Suspense boundary for UI
Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1589
This commit is contained in:
parent
9c1effc9ee
commit
f844f147b0
|
@ -41,39 +41,16 @@ const SoapboxMount = () => {
|
||||||
return !(location.state?.soapboxModalKey && location.state?.soapboxModalKey !== prevRouterProps?.location?.state?.soapboxModalKey);
|
return !(location.state?.soapboxModalKey && location.state?.soapboxModalKey !== prevRouterProps?.location?.state?.soapboxModalKey);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Render the onboarding flow. */
|
|
||||||
const renderOnboarding = () => (
|
|
||||||
<Suspense fallback={<LoadingScreen />}>
|
|
||||||
<OnboardingWizard />
|
|
||||||
</Suspense>
|
|
||||||
);
|
|
||||||
|
|
||||||
/** Render the auth layout or UI. */
|
|
||||||
const renderSwitch = () => (
|
|
||||||
<Switch>
|
|
||||||
{(!me && redirectRootNoLogin) && (
|
|
||||||
<Redirect exact from='/' to={redirectRootNoLogin} />
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Route path='/' component={UI} />
|
|
||||||
</Switch>
|
|
||||||
);
|
|
||||||
|
|
||||||
/** Render the onboarding flow or UI. */
|
|
||||||
const renderBody = () => {
|
|
||||||
if (showOnboarding) {
|
|
||||||
return renderOnboarding();
|
|
||||||
} else {
|
|
||||||
return renderSwitch();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<BrowserRouter basename={BuildConfig.FE_SUBDIRECTORY}>
|
<BrowserRouter basename={BuildConfig.FE_SUBDIRECTORY}>
|
||||||
<CompatRouter>
|
<CompatRouter>
|
||||||
<ScrollContext shouldUpdateScroll={shouldUpdateScroll}>
|
<ScrollContext shouldUpdateScroll={shouldUpdateScroll}>
|
||||||
<Switch>
|
<Switch>
|
||||||
|
{(!me && redirectRootNoLogin) && (
|
||||||
|
<Redirect exact from='/' to={redirectRootNoLogin} />
|
||||||
|
)}
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path='/embed/:statusId'
|
path='/embed/:statusId'
|
||||||
render={(props) => (
|
render={(props) => (
|
||||||
|
@ -82,10 +59,16 @@ const SoapboxMount = () => {
|
||||||
</Suspense>
|
</Suspense>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Redirect from='/@:username/:statusId/embed' to='/embed/:statusId' />
|
<Redirect from='/@:username/:statusId/embed' to='/embed/:statusId' />
|
||||||
|
|
||||||
<Route>
|
<Route>
|
||||||
{renderBody()}
|
<Suspense fallback={<LoadingScreen />}>
|
||||||
|
{showOnboarding
|
||||||
|
? <OnboardingWizard />
|
||||||
|
: <UI />
|
||||||
|
}
|
||||||
|
</Suspense>
|
||||||
|
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<ModalContainer />
|
<ModalContainer />
|
||||||
|
|
Loading…
Reference in New Issue