Загрузка…
Загрузка…
loading.tsx — auto Suspense вокруг segment; independent async components + boundaries stream parallel; sequential await в одной page блокирует всё.
// loading.tsx — the whole segment's page is auto-wrapped in .
// Zero ceremony: this fallback shows until page.tsx's data resolves.
export default function Loading() {
return ;
}// ❌ One await at the top blocks the ENTIRE page on the slowest call.
export default async function Page() {
const reviews = await getReviews(); // 350ms
const recs = await getRecommendations(); // 800ms — page waits 1150ms total
return <>;
}// ✅ Independent boundaries stream in parallel. Shell is instant;
// each section pops in on its own timeline.
import { Suspense } from 'react';
export default function Page() {
return (
<>
{/* static, flushed at t=0 */}
}>
{/* awaits internally, 350ms */}
}>
{/* awaits internally, 800ms */}
);
}Fetches стартуют parallel — каждый async component свой request, не serial await в одном component.
Anti-pattern: top-level serial await; pattern: shell + несколько Suspense boundaries с internal await.
