These demos illustrate the behavior of suspense fallbacks in multiple scenarios with some unexpected outcomes.
Compare the behavior of these posts. After loading each page, refresh and observe the suspense fallbacks:
- post 1 with
gSP, 2 suspense boundaries above - post 2 w/o explicit
gSP, 2 suspense boundaries above - post 2 w/o explicit
gSP, 1 suspense boundary above
Also note that the presence of 2 suspense boundaries allows instant navigation to the posts, where we'd have expected typical blocking ISR behavior for non-prerendered routes.
The general set up is as follows:
layout.tsxin/[lang]route- uses
generateStaticParamswith[{lang: "en"}] - top-level navigation
- uses
- 2 child routes
/demo1and/demo2, each with their ownlayout.tsx- layouts have left-nav for child routes
- each has a post listing page
- each has two child routes for post detail
/dynamic/[postId]and/static/[postId]- each uses
generateStaticParamswith[{postId: "1"}]
- each uses
/[lang]/layout.tsxtop-level nav wrapped w/ suspense
- left nav is not wrapped w/ suspense
- left nav is wrapped w/ suspense
/[lang]/layout.tsxtop-level nav not wrapped w/ suspense
- left nav is not wrapped w/ suspense
- left nav is wrapped /w suspense
| Exhibit | Demo | Post Type | Suspense Areas | Behavior | Notes |
|---|---|---|---|---|---|
| A | 1 | Dynamic Posts | root nav, post content | expected | |
| A | 1 | Static Posts | root nav, post content | expected | with blocked nav :/ |
| A | 2 | Dynamic Posts | root nav, left nav, post content | unexpected | |
| A | 2 | Static Posts | root nav, left nav, post content | unexpected | |
| B | 1 | Dynamic Posts | post content | expected | |
| B | 1 | Static Posts | post content | expected | with blocked nav :/ |
| B | 2 | Dynamic Posts | left nav, post content | expected | |
| B | 2 | Static Posts | left nav, post content | expected | with blocked nav :/ |