Skip to content

Commit 5ff57cc

Browse files
committed
Remove automatic fetch cache instrumentation
This removes the automatic patching of the global `fetch` function in Server Components environments to dedupe requests using `React.cache`, a behavior that some RSC framework maintainers have objected to. We may revisit this decision in the future, but for now it's not worth the controversy. Frameworks that have already shipped this behavior, like Next.js, can reimplement it in userspace. I considered keeping the implementation in the codebase and disabling it by setting `enableFetchInstrumentation` to `false` everywhere, but since that also disables the tests, it doesn't seem worth it because without test coverage the behavior is likely to drift regardless. We can just revert this PR later if desired.
1 parent d4e78c4 commit 5ff57cc

12 files changed

+0
-459
lines changed

packages/react/src/ReactFetch.js

Lines changed: 0 additions & 141 deletions
This file was deleted.

packages/react/src/ReactServer.experimental.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* @flow
88
*/
99

10-
// Patch fetch
11-
import './ReactFetch';
12-
1310
export {default as __SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './ReactSharedInternalsServer';
1411

1512
import {forEach, map, count, toArray, only} from './ReactChildren';

packages/react/src/ReactServer.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* @flow
88
*/
99

10-
// Patch fetch
11-
import './ReactFetch';
12-
1310
export {default as __SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE} from './ReactSharedInternalsServer';
1411

1512
import {forEach, map, count, toArray, only} from './ReactChildren';

packages/react/src/__tests__/ReactFetch-test.js

Lines changed: 0 additions & 215 deletions
This file was deleted.

0 commit comments

Comments
 (0)