Merge branch 'ui-suspense' into 'main'
SoapboxMount: fix Suspense boundary for UI Closes #1589 See merge request soapbox-pub/soapbox!2833
This commit is contained in:
commit
0658530447
1 changed files with 11 additions and 28 deletions
|
@ -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 a new issue