Skip to content

Remove disableClientCache feature flag#36033

Open
ShehabSherif0 wants to merge 1 commit intofacebook:mainfrom
ShehabSherif0:remove-disableClientCache-flag
Open

Remove disableClientCache feature flag#36033
ShehabSherif0 wants to merge 1 commit intofacebook:mainfrom
ShehabSherif0:remove-disableClientCache-flag

Conversation

@ShehabSherif0
Copy link

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

Copilot AI review requested due to automatic review settings March 13, 2026 08:29
@meta-cla meta-cla bot added the CLA Signed label Mar 13, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the disableClientCache feature flag (previously hardcoded true everywhere) and simplifies client-side React.cache to always use the no-op implementation, eliminating unreachable flag-guarded code paths.

Changes:

  • Deleted disableClientCache from ReactFeatureFlags.js and all relevant fork flag files.
  • Simplified packages/react/src/ReactCacheClient.js to unconditionally export the no-op cache/cacheSignal.
  • Removed the www Jest test override and the @gate disableClientCache annotation from a markup client test.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/jest/setupTests.www.js Removes the __VARIANT__ override for a now-deleted flag in www Jest setup.
packages/shared/ReactFeatureFlags.js Removes the disableClientCache flag definition from shared feature flags.
packages/shared/forks/ReactFeatureFlags.www.js Removes the flag from the www fork.
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js Removes the flag from the test-renderer www fork.
packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js Removes the flag from the test-renderer native-fb fork.
packages/shared/forks/ReactFeatureFlags.test-renderer.js Removes the flag from the test-renderer fork.
packages/shared/forks/ReactFeatureFlags.native-oss.js Removes the flag from the native-oss fork.
packages/shared/forks/ReactFeatureFlags.native-fb.js Removes the flag from the native-fb fork.
packages/react/src/ReactCacheClient.js Makes cache and cacheSignal always export no-ops (no conditional import/branch).
packages/react-markup/src/tests/ReactMarkupClient-test.js Removes @gate disableClientCache since the flag no longer exists.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@ShehabSherif0 ShehabSherif0 force-pushed the remove-disableClientCache-flag branch from c797118 to 99badc9 Compare March 13, 2026 08:48
@ShehabSherif0 ShehabSherif0 force-pushed the remove-disableClientCache-flag branch from 99badc9 to 35814df Compare March 13, 2026 08:49
@MorikawaSouma
Copy link

Nice cleanup! Removing dead code paths simplifies the codebase. The changes look correct - the flag was \ rue\ everywhere, so the conditional branch was never executed.

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.

3 participants