From 92939012aed474f236222e837514b821ac9418cd Mon Sep 17 00:00:00 2001 From: Tianyu Yao Date: Mon, 28 Nov 2022 16:13:23 -0800 Subject: [PATCH] Add a separate feature flag --- .../src/__tests__/ReactDOMFiberAsync-test.js | 6 +- .../src/ReactFiberLane.new.js | 8 +- .../src/ReactFiberLane.old.js | 8 +- .../__tests__/ReactBatching-test.internal.js | 2 +- .../ReactClassSetStateCallback-test.js | 2 +- .../src/__tests__/ReactFlushSync-test.js | 4 +- .../src/__tests__/ReactHooks-test.internal.js | 2 +- .../ReactHooksWithNoopRenderer-test.js | 4 +- .../src/__tests__/ReactIncremental-test.js | 6 +- .../__tests__/ReactIncrementalUpdates-test.js | 242 +++++++++--------- .../src/__tests__/ReactOffscreen-test.js | 2 +- .../src/__tests__/ReactTransition-test.js | 2 +- .../useMutableSource-test.internal.js | 2 +- packages/shared/ReactFeatureFlags.js | 2 + .../forks/ReactFeatureFlags.native-fb.js | 1 + .../forks/ReactFeatureFlags.native-oss.js | 1 + .../forks/ReactFeatureFlags.test-renderer.js | 1 + .../ReactFeatureFlags.test-renderer.native.js | 1 + .../ReactFeatureFlags.test-renderer.www.js | 1 + .../shared/forks/ReactFeatureFlags.testing.js | 1 + .../forks/ReactFeatureFlags.testing.www.js | 1 + .../forks/ReactFeatureFlags.www-dynamic.js | 1 + .../shared/forks/ReactFeatureFlags.www.js | 1 + .../src/__tests__/useSubscription-test.js | 2 +- 24 files changed, 154 insertions(+), 149 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js index 3360ef2cbd52a..5ed762afb86a1 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js @@ -275,7 +275,7 @@ describe('ReactDOMFiberAsync', () => { expect(ops).toEqual([]); }); // Only the active updates have flushed - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(container.textContent).toEqual('ABC'); expect(ops).toEqual(['ABC']); } else { @@ -283,7 +283,7 @@ describe('ReactDOMFiberAsync', () => { expect(ops).toEqual(['BC']); } - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { instance.push('D'); expect(container.textContent).toEqual('ABC'); expect(ops).toEqual(['ABC']); @@ -296,7 +296,7 @@ describe('ReactDOMFiberAsync', () => { // Flush the async updates Scheduler.unstable_flushAll(); expect(container.textContent).toEqual('ABCD'); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(ops).toEqual(['ABC', 'ABCD']); } else { expect(ops).toEqual(['BC', 'ABCD']); diff --git a/packages/react-reconciler/src/ReactFiberLane.new.js b/packages/react-reconciler/src/ReactFiberLane.new.js index de2e119cc3c63..cfd66765d72f0 100644 --- a/packages/react-reconciler/src/ReactFiberLane.new.js +++ b/packages/react-reconciler/src/ReactFiberLane.new.js @@ -23,7 +23,7 @@ import { enableUpdaterTracking, allowConcurrentByDefault, enableTransitionTracing, - enableSyncDefaultUpdates, + enableUnifiedSyncLane, } from 'shared/ReactFeatureFlags'; import {isDevToolsPresent} from './ReactFiberDevToolsHook.new'; import {ConcurrentUpdatesByDefaultMode, NoMode} from './ReactTypeOfMode'; @@ -136,7 +136,7 @@ let nextRetryLane: Lane = RetryLane1; function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { switch (getHighestPriorityLane(lanes)) { case SyncHydrationLane: - if (enableSyncDefaultUpdates) { + if (enableUnifiedSyncLane) { let ret = SyncHydrationLane; if (lanes & DefaultHydrationLane) { ret |= DefaultHydrationLane; @@ -148,7 +148,7 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { } return SyncHydrationLane; case SyncLane: - if (enableSyncDefaultUpdates) { + if (enableUnifiedSyncLane) { let ret = SyncLane; if (lanes & DefaultLane) { ret |= DefaultLane; @@ -273,7 +273,7 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { // only difference between default updates and transition updates is that // default updates do not support refresh transitions. // Interrupt transtion if default is batched with sync. - (!enableSyncDefaultUpdates && + (!enableUnifiedSyncLane && nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) ) { diff --git a/packages/react-reconciler/src/ReactFiberLane.old.js b/packages/react-reconciler/src/ReactFiberLane.old.js index 3c9ff604a558f..6386eccebe5fe 100644 --- a/packages/react-reconciler/src/ReactFiberLane.old.js +++ b/packages/react-reconciler/src/ReactFiberLane.old.js @@ -23,7 +23,7 @@ import { enableUpdaterTracking, allowConcurrentByDefault, enableTransitionTracing, - enableSyncDefaultUpdates, + enableUnifiedSyncLane, } from 'shared/ReactFeatureFlags'; import {isDevToolsPresent} from './ReactFiberDevToolsHook.old'; import {ConcurrentUpdatesByDefaultMode, NoMode} from './ReactTypeOfMode'; @@ -136,7 +136,7 @@ let nextRetryLane: Lane = RetryLane1; function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { switch (getHighestPriorityLane(lanes)) { case SyncHydrationLane: - if (enableSyncDefaultUpdates) { + if (enableUnifiedSyncLane) { let ret = SyncHydrationLane; if (lanes & DefaultHydrationLane) { ret |= DefaultHydrationLane; @@ -148,7 +148,7 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { } return SyncHydrationLane; case SyncLane: - if (enableSyncDefaultUpdates) { + if (enableUnifiedSyncLane) { let ret = SyncLane; if (lanes & DefaultLane) { ret |= DefaultLane; @@ -273,7 +273,7 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes { // only difference between default updates and transition updates is that // default updates do not support refresh transitions. // Interrupt transtion if default is batched with sync. - (!enableSyncDefaultUpdates && + (!enableUnifiedSyncLane && nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) ) { diff --git a/packages/react-reconciler/src/__tests__/ReactBatching-test.internal.js b/packages/react-reconciler/src/__tests__/ReactBatching-test.internal.js index 6b4771493a194..f9938a79b53d9 100644 --- a/packages/react-reconciler/src/__tests__/ReactBatching-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactBatching-test.internal.js @@ -158,7 +158,7 @@ describe('ReactBlockingMode', () => { ); // Now flush the first update - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toHaveYielded(['A1', 'B1']); expect(root).toMatchRenderedOutput('A1B1'); } else { diff --git a/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js b/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js index 372151466f427..1342bd7310baa 100644 --- a/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js +++ b/packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js @@ -35,7 +35,7 @@ describe('ReactClassSetStateCallback', () => { expect(Scheduler).toHaveYielded([0]); await act(async () => { - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { React.startTransition(() => { app.setState({step: 1}, () => Scheduler.unstable_yieldValue('Callback 1'), diff --git a/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js b/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js index 17cf63e5778db..5802253e1c1f1 100644 --- a/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js +++ b/packages/react-reconciler/src/__tests__/ReactFlushSync-test.js @@ -55,7 +55,7 @@ describe('ReactFlushSync', () => { // They should commit in two separate batches. First the sync one. expect(() => { expect(Scheduler).toFlushUntilNextPaint( - gate(flags => flags.enableSyncDefaultUpdates) ? ['1, 1'] : ['1, 0'], + gate(flags => flags.enableUnifiedSyncLane) ? ['1, 1'] : ['1, 0'], ); }).toErrorDev('flushSync was called from inside a lifecycle method'); @@ -63,7 +63,7 @@ describe('ReactFlushSync', () => { ReactNoop.flushSync(); expect(Scheduler).toHaveYielded([]); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toFlushUntilNextPaint([]); } else { // Now flush it. diff --git a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js index e6f989d296d82..ebf4a25446929 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js @@ -568,7 +568,7 @@ describe('ReactHooks', () => { }); }; - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { // Update at transition priority React.startTransition(() => update(n => n * 100)); } else { diff --git a/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js b/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js index 6cdde2b901632..ff4dca3d2ad8d 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js +++ b/packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js @@ -961,7 +961,7 @@ describe('ReactHooksWithNoopRenderer', () => { ReactNoop.flushSync(() => { counter.current.dispatch(INCREMENT); }); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toHaveYielded(['Count: 4']); expect(ReactNoop.getChildren()).toEqual([span('Count: 4')]); } else { @@ -1727,7 +1727,7 @@ describe('ReactHooksWithNoopRenderer', () => { // As a result we, somewhat surprisingly, commit them in the opposite order. // This should be fine because any non-discrete set of work doesn't guarantee order // and easily could've happened slightly later too. - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toHaveYielded(['Will set count to 1', 'Count: 1']); } else { expect(Scheduler).toHaveYielded([ diff --git a/packages/react-reconciler/src/__tests__/ReactIncremental-test.js b/packages/react-reconciler/src/__tests__/ReactIncremental-test.js index 3b047a2973ed7..29376674a680c 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncremental-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncremental-test.js @@ -1910,7 +1910,7 @@ describe('ReactIncremental', () => { , ); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toFlushAndYield([ 'Intl {}', 'ShowLocale {"locale":"en"}', @@ -2774,7 +2774,7 @@ describe('ReactIncremental', () => { // Interrupt at same priority ReactNoop.render(); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toFlushAndYield(['Parent: 2', 'Child: 2']); } else { expect(Scheduler).toFlushAndYield(['Child: 1', 'Parent: 2', 'Child: 2']); @@ -2805,7 +2805,7 @@ describe('ReactIncremental', () => { ReactNoop.expire(2000); ReactNoop.render(); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toFlushAndYield(['Parent: 2', 'Child: 2']); } else { expect(Scheduler).toFlushAndYield(['Child: 1', 'Parent: 2', 'Child: 2']); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js index 552ff16148229..fa5acdbf33d09 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js @@ -162,7 +162,11 @@ describe('ReactIncrementalUpdates', () => { } // Schedule some async updates - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if ( + gate( + flags => flags.enableSyncDefaultUpdates || flags.enableUnifiedSyncLane, + ) + ) { React.startTransition(() => { instance.setState(createUpdate('a')); instance.setState(createUpdate('b')); @@ -179,70 +183,65 @@ describe('ReactIncrementalUpdates', () => { expect(ReactNoop.getChildren()).toEqual([span('')]); // Schedule some more updates at different priorities - if (gate(flags => flags.enableSyncDefaultUpdates)) { - instance.setState(createUpdate('d')); - ReactNoop.flushSync(() => { - instance.setState(createUpdate('e')); - instance.setState(createUpdate('f')); - }); - React.startTransition(() => { - instance.setState(createUpdate('g')); - }); + instance.setState(createUpdate('d')); + ReactNoop.flushSync(() => { + instance.setState(createUpdate('e')); + instance.setState(createUpdate('f')); + }); + React.startTransition(() => { + instance.setState(createUpdate('g')); + }); - // The sync updates should have flushed, but not the async ones + // The sync updates should have flushed, but not the async ones. + if ( + gate( + flags => flags.enableSyncDefaultUpdates && flags.enableUnifiedSyncLane, + ) + ) { expect(Scheduler).toHaveYielded(['d', 'e', 'f']); expect(ReactNoop.getChildren()).toEqual([span('def')]); - - // Now flush the remaining work. Even though e and f were already processed, - // they should be processed again, to ensure that the terminal state - // is deterministic. - if (gate(flags => flags.enableSyncDefaultUpdates)) { - expect(Scheduler).toFlushAndYield([ - // Then we'll re-process everything for 'g'. - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - ]); - } else { - expect(Scheduler).toFlushAndYield([ - // Since 'g' is in a transition, we'll process 'd' separately first. - // That causes us to process 'd' with 'e' and 'f' rebased. - 'd', - 'e', - 'f', - // Then we'll re-process everything for 'g'. - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - ]); - } - expect(ReactNoop.getChildren()).toEqual([span('abcdefg')]); } else { - instance.setState(createUpdate('d')); - ReactNoop.flushSync(() => { - instance.setState(createUpdate('e')); - instance.setState(createUpdate('f')); - }); - instance.setState(createUpdate('g')); - - // The sync updates should have flushed, but not the async ones + // Update d was dropped and replaced by e. expect(Scheduler).toHaveYielded(['e', 'f']); expect(ReactNoop.getChildren()).toEqual([span('ef')]); + } - // Now flush the remaining work. Even though e and f were already processed, - // they should be processed again, to ensure that the terminal state - // is deterministic. - expect(Scheduler).toFlushAndYield(['a', 'b', 'c', 'd', 'e', 'f', 'g']); - expect(ReactNoop.getChildren()).toEqual([span('abcdefg')]); + // Now flush the remaining work. Even though e and f were already processed, + // they should be processed again, to ensure that the terminal state + // is deterministic. + if ( + gate( + flags => flags.enableSyncDefaultUpdates && !flags.enableUnifiedSyncLane, + ) + ) { + expect(Scheduler).toFlushAndYield([ + // Since 'g' is in a transition, we'll process 'd' separately first. + // That causes us to process 'd' with 'e' and 'f' rebased. + 'd', + 'e', + 'f', + // Then we'll re-process everything for 'g'. + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + ]); + } else { + expect(Scheduler).toFlushAndYield([ + // Then we'll re-process everything for 'g'. + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + ]); } + expect(ReactNoop.getChildren()).toEqual([span('abcdefg')]); }); it('can abort an update, schedule a replaceState, and resume', () => { @@ -274,7 +273,11 @@ describe('ReactIncrementalUpdates', () => { } // Schedule some async updates - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if ( + gate( + flags => flags.enableSyncDefaultUpdates || flags.enableUnifiedSyncLane, + ) + ) { React.startTransition(() => { instance.setState(createUpdate('a')); instance.setState(createUpdate('b')); @@ -291,76 +294,67 @@ describe('ReactIncrementalUpdates', () => { expect(ReactNoop.getChildren()).toEqual([span('')]); // Schedule some more updates at different priorities - if (gate(flags => flags.enableSyncDefaultUpdates)) { - instance.setState(createUpdate('d')); + instance.setState(createUpdate('d')); - ReactNoop.flushSync(() => { - instance.setState(createUpdate('e')); - // No longer a public API, but we can test that it works internally by - // reaching into the updater. - instance.updater.enqueueReplaceState(instance, createUpdate('f')); - }); - React.startTransition(() => { - instance.setState(createUpdate('g')); - }); + ReactNoop.flushSync(() => { + instance.setState(createUpdate('e')); + // No longer a public API, but we can test that it works internally by + // reaching into the updater. + instance.updater.enqueueReplaceState(instance, createUpdate('f')); + }); + React.startTransition(() => { + instance.setState(createUpdate('g')); + }); - // The sync updates should have flushed, but not the async ones. + // The sync updates should have flushed, but not the async ones. + if ( + gate( + flags => flags.enableSyncDefaultUpdates && flags.enableUnifiedSyncLane, + ) + ) { expect(Scheduler).toHaveYielded(['d', 'e', 'f']); - expect(ReactNoop.getChildren()).toEqual([span('f')]); - - // Now flush the remaining work. Even though e and f were already processed, - // they should be processed again, to ensure that the terminal state - // is deterministic. - if (gate(flags => flags.enableSyncDefaultUpdates)) { - expect(Scheduler).toFlushAndYield([ - // Then we'll re-process everything for 'g'. - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - ]); - } else { - expect(Scheduler).toFlushAndYield([ - // Since 'g' is in a transition, we'll process 'd' separately first. - // That causes us to process 'd' with 'e' and 'f' rebased. - 'd', - 'e', - 'f', - // Then we'll re-process everything for 'g'. - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', - 'g', - ]); - } - expect(ReactNoop.getChildren()).toEqual([span('fg')]); } else { - instance.setState(createUpdate('d')); - ReactNoop.flushSync(() => { - instance.setState(createUpdate('e')); - // No longer a public API, but we can test that it works internally by - // reaching into the updater. - instance.updater.enqueueReplaceState(instance, createUpdate('f')); - }); - instance.setState(createUpdate('g')); - - // The sync updates should have flushed, but not the async ones. Update d - // was dropped and replaced by e. + // Update d was dropped and replaced by e. expect(Scheduler).toHaveYielded(['e', 'f']); - expect(ReactNoop.getChildren()).toEqual([span('f')]); - - // Now flush the remaining work. Even though e and f were already processed, - // they should be processed again, to ensure that the terminal state - // is deterministic. - expect(Scheduler).toFlushAndYield(['a', 'b', 'c', 'd', 'e', 'f', 'g']); - expect(ReactNoop.getChildren()).toEqual([span('fg')]); } + expect(ReactNoop.getChildren()).toEqual([span('f')]); + + // Now flush the remaining work. Even though e and f were already processed, + // they should be processed again, to ensure that the terminal state + // is deterministic. + if ( + gate( + flags => flags.enableSyncDefaultUpdates && !flags.enableUnifiedSyncLane, + ) + ) { + expect(Scheduler).toFlushAndYield([ + // Since 'g' is in a transition, we'll process 'd' separately first. + // That causes us to process 'd' with 'e' and 'f' rebased. + 'd', + 'e', + 'f', + // Then we'll re-process everything for 'g'. + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + ]); + } else { + expect(Scheduler).toFlushAndYield([ + // Then we'll re-process everything for 'g'. + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + ]); + } + expect(ReactNoop.getChildren()).toEqual([span('fg')]); }); it('passes accumulation of previous updates to replaceState updater function', () => { @@ -714,7 +708,7 @@ describe('ReactIncrementalUpdates', () => { pushToLog('B'), ); }); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toHaveYielded([ 'Committed: B', 'Committed: BCD', @@ -782,7 +776,7 @@ describe('ReactIncrementalUpdates', () => { pushToLog('B'), ); }); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toHaveYielded([ 'Committed: B', 'Committed: BCD', diff --git a/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js b/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js index 7f77ba535517c..2faf84ce87563 100644 --- a/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js +++ b/packages/react-reconciler/src/__tests__/ReactOffscreen-test.js @@ -673,7 +673,7 @@ describe('ReactOffscreen', () => { ); // Before the inner update can finish, we receive another pair of updates. - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { React.startTransition(() => { setOuter(2); setInner(2); diff --git a/packages/react-reconciler/src/__tests__/ReactTransition-test.js b/packages/react-reconciler/src/__tests__/ReactTransition-test.js index df9a4b48579ff..6c7a91a27111e 100644 --- a/packages/react-reconciler/src/__tests__/ReactTransition-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTransition-test.js @@ -934,7 +934,7 @@ describe('ReactTransition', () => { updateNormalPri(); }); - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { expect(Scheduler).toHaveYielded([ // Interrupt transition. 'Transition pri: 0', diff --git a/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js b/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js index 81c1b7bc47e9e..c4ca0ae1de995 100644 --- a/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js +++ b/packages/react-reconciler/src/__tests__/useMutableSource-test.internal.js @@ -1558,7 +1558,7 @@ describe('useMutableSource', () => { expect(Scheduler).toFlushAndYieldThrough(['a0', 'b0']); // Mutate in an event. This schedules a subscription update on a, which // already mounted, but not b, which hasn't subscribed yet. - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { React.startTransition(() => { mutateA('a1'); mutateB('b1'); diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 23e74d128cca8..67a4970a5366e 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -155,6 +155,8 @@ export const enableUseRefAccessWarning = false; // Enables time slicing for updates that aren't wrapped in startTransition. export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = __EXPERIMENTAL__; + // Adds an opt-in to time slicing for updates that aren't wrapped in // startTransition. Only relevant when enableSyncDefaultUpdates is disabled. export const allowConcurrentByDefault = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index ac5f8de086201..2e14acfbb101c 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -73,6 +73,7 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; export const enableLegacyHidden = true; export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = false; export const allowConcurrentByDefault = true; export const enableCustomElementPropertySupport = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 994fab5272e2c..8243e9ec142d8 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -64,6 +64,7 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; export const enableLegacyHidden = false; export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = false; export const allowConcurrentByDefault = false; export const enableCustomElementPropertySupport = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 2105a3e303ad2..7885c46be7b45 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -64,6 +64,7 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; export const enableLegacyHidden = false; export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = __EXPERIMENTAL__; export const allowConcurrentByDefault = false; export const enableCustomElementPropertySupport = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index a9574a110aa24..5cb2a39e11ac0 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -63,6 +63,7 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; export const enableLegacyHidden = false; export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = false; export const allowConcurrentByDefault = true; export const consoleManagedByDevToolsDuringStrictMode = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 3c0de034a7bf7..28d10b4cbf999 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -64,6 +64,7 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; export const enableLegacyHidden = false; export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = false; export const allowConcurrentByDefault = true; export const enableCustomElementPropertySupport = false; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.js b/packages/shared/forks/ReactFeatureFlags.testing.js index 3e7ec4d238c2e..2f831f10bf465 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.js @@ -64,6 +64,7 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; export const enableLegacyHidden = false; export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = __EXPERIMENTAL__; export const allowConcurrentByDefault = false; export const enableCustomElementPropertySupport = false; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.www.js b/packages/shared/forks/ReactFeatureFlags.testing.www.js index 56fee4169077d..4a428b9937751 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.www.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.www.js @@ -64,6 +64,7 @@ export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; export const enableLegacyHidden = false; export const enableSyncDefaultUpdates = true; +export const enableUnifiedSyncLane = __EXPERIMENTAL__; export const allowConcurrentByDefault = true; export const enableCustomElementPropertySupport = false; diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js index 882871de6f507..12b4ba8d35fde 100644 --- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js @@ -24,6 +24,7 @@ export const enableProfilerNestedUpdateScheduledHook = __VARIANT__; export const disableSchedulerTimeoutInWorkLoop = __VARIANT__; export const enableLazyContextPropagation = __VARIANT__; export const enableSyncDefaultUpdates = __VARIANT__; +export const enableUnifiedSyncLane = __VARIANT__; export const consoleManagedByDevToolsDuringStrictMode = __VARIANT__; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = __VARIANT__; export const enableClientRenderFallbackOnTextMismatch = __VARIANT__; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index 513c7562c7f36..4f453e9afd415 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -31,6 +31,7 @@ export const { disableSchedulerTimeoutInWorkLoop, enableLazyContextPropagation, enableSyncDefaultUpdates, + enableUnifiedSyncLane, enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, enableClientRenderFallbackOnTextMismatch, enableTransitionTracing, diff --git a/packages/use-subscription/src/__tests__/useSubscription-test.js b/packages/use-subscription/src/__tests__/useSubscription-test.js index 1d481e1d599b4..ee89c3dbb9562 100644 --- a/packages/use-subscription/src/__tests__/useSubscription-test.js +++ b/packages/use-subscription/src/__tests__/useSubscription-test.js @@ -454,7 +454,7 @@ describe('useSubscription', () => { observableA.next('a-2'); // Update again - if (gate(flags => flags.enableSyncDefaultUpdates)) { + if (gate(flags => flags.enableUnifiedSyncLane)) { React.startTransition(() => { renderer.update(); });