Skip to content

Commit e1f4e57

Browse files
fix: Fix the Suspense boundaries in the root layout
1 parent 4028246 commit e1f4e57

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/app/layout.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,18 @@ export const metadata: Metadata = {
5353
};
5454

5555
// This component will be wrapped in Suspense in the BaseLayout
56-
async function Providers({ children }: { children: React.ReactNode }) {
57-
// These async operations will be handled by Suspense in the parent component
56+
function Providers({ children }: { children: React.ReactNode }) {
57+
return (
58+
<Suspense fallback={<ProvidersFallback />}>
59+
<ProvidersContent>
60+
{children}
61+
</ProvidersContent>
62+
</Suspense>
63+
);
64+
}
65+
66+
// This is the async component that fetches config
67+
async function ProvidersContent({ children }: { children: React.ReactNode }) {
5868
const config = await getConfig();
5969

6070
return (
@@ -87,11 +97,9 @@ export default function BaseLayout({
8797
shadow="0 0 10px #000, 0 0 5px #000"
8898
height={4}
8999
/>
90-
<Suspense fallback={<ProvidersFallback />}>
91-
<Providers>
92-
{children}
93-
</Providers>
94-
</Suspense>
100+
<Providers>
101+
{children}
102+
</Providers>
95103
<Toaster richColors closeButton position="top-right" expand duration={7000} />
96104
<StartupStudioStickyBanner />
97105
</body>

0 commit comments

Comments
 (0)