Skip to content

Remove disableClientCache feature flag#708

Open
everettbu wants to merge 1 commit intomainfrom
remove-disableClientCache-flag
Open

Remove disableClientCache feature flag#708
everettbu wants to merge 1 commit intomainfrom
remove-disableClientCache-flag

Conversation

@everettbu
Copy link
Copy Markdown

Mirror of facebook/react#36033
Original author: ShehabSherif0


Summary

The disableClientCache feature flag is set to true in all environments (main flags file, www, native-fb, native-oss, test-renderer, test-renderer.www, test-renderer.native-fb). This PR removes the flag and the dead code path it guarded.

When disableClientCache was true, ReactCacheClient.js exported noopCache and noopCacheSignal (no-ops that pass through or return null). With the flag hardcoded to true everywhere, the conditional branch that imported the real cache implementation from ReactCacheImpl.js was unreachable dead code.

This PR:

  • Removes the disableClientCache flag from ReactFeatureFlags.js and all 6 fork files
  • Simplifies ReactCacheClient.js to unconditionally export the no-op implementations
  • Removes the __VARIANT__ test override in setupTests.www.js
  • Removes the ``@gate disableClientCache annotation from a test in `ReactMarkupClient-test.js`

Note: ReactCacheServer.js is unaffected -- it imports directly from ReactCacheImpl.js without any flag check.

How did you test this change?

  • yarn linc (lint on changed files): passed
  • yarn test (dev mode, experimental): all cache and markup tests passed (23/23)
  • yarn test --prod (production mode, experimental): all tests passed (23/23)
  • yarn test -r www-modern (www variant): all tests passed (6/6)
  • yarn flow (Flow type checks): 0 errors
  • Verified zero remaining references to disableClientCache across the codebase

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR cleanly removes the disableClientCache feature flag, which was hardcoded to true across all 7 environments (main flags file + 6 forks), making the real cache implementation in ReactCacheImpl.js an unreachable dead code path for the client. The PR simplifies ReactCacheClient.js to unconditionally export the noop implementations (noopCache and noopCacheSignal), removes the flag from all fork files, cleans up the www Jest variant override in setupTests.www.js, and drops the @gate disableClientCache test annotation.

  • ReactCacheClient.js: The conditional disableClientCache ? noopCache : cacheImpl is replaced with a direct noopCache assignment; the now-unused import of ReactCacheImpl is also removed.
  • ReactFeatureFlags.js + 6 forks: All exports of disableClientCache: boolean = true are dropped. A codebase-wide search confirms zero remaining references to the flag.
  • setupTests.www.js: The __VARIANT__-based override for disableClientCache is removed since there is nothing left to vary.
  • ReactMarkupClient-test.js: The @gate disableClientCache annotation is removed so the "does NOT support cache yet" test runs unconditionally under __EXPERIMENTAL__, matching the now-permanent noop behavior.
  • ReactCacheServer.js is correctly left untouched — it imports directly from ReactCacheImpl.js without any flag guard.

Confidence Score: 5/5

  • This PR is safe to merge — it removes fully dead code with no behavior change in any environment.
  • The flag was true everywhere, so the noop branch was always taken. The removal is exhaustive (all 7 flag files updated, zero remaining references confirmed by grep), the server-side cache path is unaffected, and the test suite adjustments are correct. No logic changes, no API surface changes, and no cross-environment inconsistencies introduced.
  • No files require special attention.

Important Files Changed

Filename Overview
packages/react/src/ReactCacheClient.js Removes the conditional disableClientCache check and unconditionally exports the noop implementations. Since the flag was hardcoded to true everywhere, this is a pure dead-code cleanup with no behavior change.
packages/shared/ReactFeatureFlags.js Removes the disableClientCache: boolean = true export from the canonical feature flags file. All 6 fork files are consistently updated to match.
scripts/jest/setupTests.www.js Removes the actual.disableClientCache = __VARIANT__ line that forced www tests to run against both flag variants. Correct cleanup since the flag no longer exists.
packages/react-markup/src/tests/ReactMarkupClient-test.js Removes the // @gate disableClientCache annotation from the "does NOT support cache yet" test so it runs unconditionally under __EXPERIMENTAL__, which is correct since noop caching is now the permanent behavior.
packages/shared/forks/ReactFeatureFlags.www.js Removes disableClientCache: boolean = true from the www fork. The remaining Flow type constraint at the bottom of the file ensures the fork stays in sync with the canonical flags file.
packages/shared/forks/ReactFeatureFlags.native-fb.js Removes disableClientCache: boolean = true from the native-fb fork. Consistent with all other fork changes.
packages/shared/forks/ReactFeatureFlags.native-oss.js Removes disableClientCache: boolean = true from the native-oss fork. Consistent with all other fork changes.
packages/shared/forks/ReactFeatureFlags.test-renderer.js Removes disableClientCache: boolean = true from the test-renderer fork. Consistent with all other fork changes.
packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js Removes disableClientCache = true from the test-renderer native-fb fork. Consistent with all other fork changes.
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js Removes disableClientCache: boolean = true from the test-renderer www fork. Consistent with all other fork changes.

Last reviewed commit: 35814df

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants