Skip to content

Commit

Permalink
Disable legacy context
Browse files Browse the repository at this point in the history
This enables the `disableLegacyContext` flag for web and React Native.
  • Loading branch information
kassens committed Mar 12, 2024
1 parent 89021fb commit e4f2308
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ describe('ReactComponentLifeCycle', () => {
});

if (!require('shared/ReactFeatureFlags').disableModulePatternComponents) {
// @gate !disableLegacyContext
it('calls effects on module-pattern component', async () => {
const log = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ describe('ReactLegacyErrorBoundaries', () => {
});

if (!require('shared/ReactFeatureFlags').disableModulePatternComponents) {
// @gate !disableLegacyContext
// @gate !disableLegacyMode
it('renders an error state if module-style context provider throws in componentWillMount', () => {
function BrokenComponentWillMountWithContext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,7 @@ describe('ReactIncrementalErrorHandling', () => {
});

// @gate !disableModulePatternComponents
// @gate !disableLegacyContext
it('handles error thrown inside getDerivedStateFromProps of a module-style context provider', async () => {
function Provider() {
return {
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ export const transitionLaneExpirationMs = 5000;
// -----------------------------------------------------------------------------
const __NEXT_MAJOR__ = __EXPERIMENTAL__;

// Not ready to break experimental yet.
export const disableLegacyContext = false;
// Removes legacy style context
export const disableLegacyContext = __NEXT_MAJOR__;

// Not ready to break experimental yet.
// Disable javascript: URL strings in href for XSS protection.
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const disableIEWorkarounds = true;
export const enableScopeAPI = false;
export const enableCreateEventHandleAPI = false;
export const enableSuspenseCallback = false;
export const disableLegacyContext = false;
export const enableTrustedTypesIntegration = false;
export const disableTextareaChildren = false;
export const disableModulePatternComponents = false;
Expand Down Expand Up @@ -100,6 +99,7 @@ export const disableStringRefs = __NEXT_MAJOR__;
export const enableReactTestRendererWarning = false;
export const enableBigIntSupport = __NEXT_MAJOR__;
export const disableLegacyMode = __NEXT_MAJOR__;
export const disableLegacyContext = __NEXT_MAJOR__;

// Flow magic to verify the exports of this file match the original version.
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

0 comments on commit e4f2308

Please sign in to comment.