Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Demo] Add lazy loading to CRM demo to illustrate code splitting #9255

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Sep 6, 2023

Problem

Large apps need to do code splitting. It turns out it's not as simple as using React.lazy(), as the layouts don't use Suspense by default.

Solution

Update the CRM demo example to illustrate the way to do it.

@@ -14,7 +14,7 @@ const Layout = ({ children }: LayoutProps) => (
<main id="main-content">
{/* @ts-ignore */}
<ErrorBoundary FallbackComponent={Error}>
{children}
<Suspense fallback={<Loading />}>{children}</Suspense>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we shouldn't do that by default on all our layouts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably

@fzaninotto fzaninotto added the RFR Ready For Review label Sep 6, 2023
@djhi djhi added this to the 4.13.4 milestone Sep 6, 2023
@djhi djhi merged commit 8a3e7c0 into master Sep 6, 2023
@djhi djhi deleted the demo-lazy branch September 6, 2023 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants