dillon1000/react

Commit

Remove client caching from cache() API (#27977)

We haven't yet decided how we want `cache` to work on the client. The
lifetime of the cache is more complex than on the server, where it only
has to live as long as a single request.

Since it's more important to ship this on the server, we're removing the
existing behavior from the client for now. On the client (i.e. not a
Server Components environment) `cache` will have not have any caching
behavior. `cache(fn)` will return the function as-is.

We intend to implement client caching in a future major release. In the
meantime, it's only exposed as an API so that Shared Components can use
per-request caching on the server without breaking on the client.
Browse files
Changed paths8 files
First-parent comparison
M packages/react-reconciler/src/__tests__/ReactCache-test.js ModifiedA packages/react-reconciler/src/__tests__/ReactCacheElement-test.js AddedM packages/react-reconciler/src/__tests__/ReactUse-test.js ModifiedA packages/react/src/ReactCacheClient.js AddedR packages/react/src/ReactCache.js →packages/react/src/ReactCacheServer.js RenamedM packages/react/src/ReactClient.js ModifiedM packages/react/src/ReactServer.experimental.js ModifiedM packages/react/src/ReactServer.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…