Skip to content

Commit 49f5a99

Browse files
committed
[use] Add Pitfall on refetching Promises from context in RSCs
1 parent 0856e4e commit 49f5a99

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • src/content/reference/react

src/content/reference/react/use.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ Reading the value requires two `use` calls because the context value itself isn'
240240
241241
Wrap the components that read the Promise in a [Suspense](/reference/react/Suspense) boundary so only that subtree suspends while the Promise is pending. See [Usage (Promises)](#usage-promises) below for more on reading Promises with `use`.
242242
243+
<Pitfall>
244+
245+
When this pattern is used with [Server Components](/reference/rsc/server-components), refetching the Promise requires refetching the Server Component that sets the Promise in context. Avoid setting the Promise in context high in the tree, since that would refetch large parts of the app unnecessarily.
246+
247+
</Pitfall>
248+
243249
---
244250
245251
## Usage (Promises) {/*usage-promises*/}

0 commit comments

Comments
 (0)