Skip to content

Commit

Permalink
feat(web): add loadingPage to AppRouteContainer (#1038)
Browse files Browse the repository at this point in the history
Co-authored-by: Black-Hole <158blackhole@gmail.com>
  • Loading branch information
Cheerego7 and BlackHole1 committed Oct 27, 2021
1 parent 508bfdb commit c402fcc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web/flat-web/src/AppRoutes/AppRouteContainer.tsx
Expand Up @@ -6,6 +6,7 @@ import { useIsomorphicLayoutEffect } from "react-use";
import { PageStoreContext } from "../components/StoreProvider";
import { RouteNameType } from "../route-config";
import { AppRouteErrorBoundary } from "./AppRouteErrorBoundary";
import { LoadingPage } from "flat-components";

export interface AppRouteContainerProps {
name: RouteNameType;
Expand Down Expand Up @@ -34,5 +35,12 @@ export const AppRouteContainer: FC<AppRouteContainerProps> = ({
window.getSelection()?.removeAllRanges();
}, [t, title]);

return <AppRouteErrorBoundary Comp={loadable(Comp)} {...{ title, routeProps }} />;
return (
<AppRouteErrorBoundary
Comp={loadable(Comp, {
fallback: <LoadingPage />,
})}
{...{ title, routeProps }}
/>
);
};

0 comments on commit c402fcc

Please sign in to comment.