Skip to content

Commit

Permalink
Add alwaysThrottleDisappearingFallbacks Flag (#28550)
Browse files Browse the repository at this point in the history
## Summary

Creates a new `alwaysThrottleDisappearingFallbacks` feature flag that
gates the changes from #26802
(instead of being controlled by `alwaysThrottleRetries`). The values of
this new flag mirror the current values of `alwaysThrottleRetries` such
that there is no behavior difference.

This additional feature flag allows us to incrementally validate the
change (arguably bug fix) from
#26802 independently from
`alwaysThrottleRetries`.

## How did you test this change?

```
$ yarn test
$ yarn flow dom-browser
$ yarn flow dom-fb
$ yarn flow fabric
```
  • Loading branch information
yungsters authored Mar 18, 2024
1 parent 7959a1d commit 0aab065
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import type {
} from './ReactFiberTracingMarkerComponent';

import {
alwaysThrottleDisappearingFallbacks,
enableCreateEventHandleAPI,
enableProfilerTimer,
enableProfilerCommitHooks,
Expand All @@ -53,7 +54,6 @@ import {
enableUseEffectEventHook,
enableFloat,
enableLegacyHidden,
alwaysThrottleRetries,
disableStringRefs,
} from 'shared/ReactFeatureFlags';
import {
Expand Down Expand Up @@ -2896,7 +2896,7 @@ function commitMutationEffectsOnFiber(
current !== null &&
(current.memoizedState: SuspenseState | null) !== null;

if (alwaysThrottleRetries) {
if (alwaysThrottleDisappearingFallbacks) {
if (isShowingFallback !== wasShowingFallback) {
// A fallback is either appearing or disappearing.
markCommitTimeOfFallback();
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export const enableUseEffectEventHook = __EXPERIMENTAL__;
// (handled with an MutationObserver) instead of inline-scripts
export const enableFizzExternalRuntime = true;

export const alwaysThrottleDisappearingFallbacks = true;

export const alwaysThrottleRetries = true;

export const passChildrenWhenCloningPersistedNodes = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags';
// flag here but it won't be set to `true` in any of our test runs. Need to
// update the test configuration.

export const alwaysThrottleDisappearingFallbacks = __VARIANT__;
export const alwaysThrottleRetries = __VARIANT__;
export const consoleManagedByDevToolsDuringStrictMode = __VARIANT__;
export const enableAsyncActions = __VARIANT__;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as dynamicFlags from 'ReactNativeInternalFeatureFlags';
// We destructure each value before re-exporting to avoid a dynamic look-up on
// the exports object every time a flag is read.
export const {
alwaysThrottleDisappearingFallbacks,
alwaysThrottleRetries,
consoleManagedByDevToolsDuringStrictMode,
enableAsyncActions,
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const enableInfiniteRenderLoopDetection = false;

export const enableAsyncActions = false;

export const alwaysThrottleDisappearingFallbacks = false;
export const alwaysThrottleRetries = false;

export const passChildrenWhenCloningPersistedNodes = false;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const enableDeferRootSchedulingToMicrotask = true;

export const enableAsyncActions = true;

export const alwaysThrottleDisappearingFallbacks = true;
export const alwaysThrottleRetries = true;

export const passChildrenWhenCloningPersistedNodes = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const enableDeferRootSchedulingToMicrotask = false;

export const enableAsyncActions = true;

export const alwaysThrottleDisappearingFallbacks = true;
export const alwaysThrottleRetries = true;

export const passChildrenWhenCloningPersistedNodes = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const enableDeferRootSchedulingToMicrotask = true;

export const enableAsyncActions = true;

export const alwaysThrottleDisappearingFallbacks = false;
export const alwaysThrottleRetries = true;

export const passChildrenWhenCloningPersistedNodes = false;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.www-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const forceConcurrentByDefaultForTesting = __VARIANT__;
export const enableUnifiedSyncLane = __VARIANT__;
export const enableTransitionTracing = __VARIANT__;
export const enableDeferRootSchedulingToMicrotask = __VARIANT__;
export const alwaysThrottleDisappearingFallbacks = __VARIANT__;
export const alwaysThrottleRetries = __VARIANT__;
export const enableDO_NOT_USE_disableStrictPassiveEffect = __VARIANT__;
export const enableUseDeferredValueInitialArg = __VARIANT__;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const {
enableRetryLaneExpiration,
enableTransitionTracing,
enableDeferRootSchedulingToMicrotask,
alwaysThrottleDisappearingFallbacks,
alwaysThrottleRetries,
enableDO_NOT_USE_disableStrictPassiveEffect,
disableSchedulerTimeoutInWorkLoop,
Expand Down
1 change: 1 addition & 0 deletions scripts/flow/xplat.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

declare module 'ReactNativeInternalFeatureFlags' {
declare export var alwaysThrottleDisappearingFallbacks: boolean;
declare export var alwaysThrottleRetries: boolean;
declare export var consoleManagedByDevToolsDuringStrictMode: boolean;
declare export var enableAsyncActions: boolean;
Expand Down

0 comments on commit 0aab065

Please sign in to comment.