Skip to content

Commit 79247ae

Browse files
authored
docs: Update caveats for React cache documentation
Clarify cache behavior and limitations in React.
1 parent cffb6a7 commit 79247ae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/content/reference/react/cache.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ The optimization of caching return values based on inputs is known as [_memoizat
6464

6565
- React will invalidate the cache for all memoized functions for each server request.
6666
- Each call to `cache` creates a new function. This means that calling `cache` with the same function multiple times will return different memoized functions that do not share the same cache.
67+
- React uses shallow comparison (`Object.is`) for arguments. Passing a new object or array on every call will bypass the cache.
6768
- `cachedFn` will also cache errors. If `fn` throws an error for certain arguments, it will be cached, and the same error is re-thrown when `cachedFn` is called with those same arguments.
6869
- `cache` is for use in [Server Components](/reference/rsc/server-components) only.
6970

0 commit comments

Comments
 (0)