| 1 | --- |
| 2 | title: Parallel Nested Data Fetching |
| 3 | impact: CRITICAL |
| 4 | impactDescription: eliminates server-side waterfalls |
| 5 | tags: server, rsc, parallel-fetching, promise-chaining |
| 6 | --- |
| 7 | |
| 8 | ## Parallel Nested Data Fetching |
| 9 | |
| 10 | When fetching nested data in parallel, chain dependent fetches within each item's promise so a slow item doesn't block the rest. |
| 11 | |
| 12 | **Incorrect (a single slow item blocks all nested fetches):** |
| 13 | |
| 14 | ```tsx |
| 15 | const chats = await |
| 16 | |
| 17 | const chatAuthors = await |
| 18 | ``` |
| 19 | |
| 20 | If one `getChat(id)` out of 100 is extremely slow, the authors of the other 99 chats can't start loading even though their data is ready. |
| 21 | |
| 22 | **Correct (each item chains its own nested fetch):** |
| 23 | |
| 24 | ```tsx |
| 25 | const chatAuthors = await |
| 26 | chatIds.map((id |
| 27 | ); |
| 28 | ``` |
| 29 | |
| 30 | Each item independently chains `getChat` → `getUser`, so a slow chat doesn't block author fetches for the others. |