Skip to content

Commit 2cc839e

Browse files
committed
Cleanup enableUnifiedSyncLane flag
1 parent ee85098 commit 2cc839e

22 files changed

+81
-266
lines changed

packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -275,32 +275,17 @@ describe('ReactDOMFiberAsync', () => {
275275
expect(ops).toEqual([]);
276276
});
277277
// Only the active updates have flushed
278-
if (gate(flags => flags.enableUnifiedSyncLane)) {
279-
expect(container.textContent).toEqual('ABC');
280-
expect(ops).toEqual(['ABC']);
281-
} else {
282-
expect(container.textContent).toEqual('BC');
283-
expect(ops).toEqual(['BC']);
284-
}
278+
expect(container.textContent).toEqual('ABC');
279+
expect(ops).toEqual(['ABC']);
285280

286-
if (gate(flags => flags.enableUnifiedSyncLane)) {
287-
instance.push('D');
288-
expect(container.textContent).toEqual('ABC');
289-
expect(ops).toEqual(['ABC']);
290-
} else {
291-
instance.push('D');
292-
expect(container.textContent).toEqual('BC');
293-
expect(ops).toEqual(['BC']);
294-
}
281+
instance.push('D');
282+
expect(container.textContent).toEqual('ABC');
283+
expect(ops).toEqual(['ABC']);
295284

296285
// Flush the async updates
297286
Scheduler.unstable_flushAll();
298287
expect(container.textContent).toEqual('ABCD');
299-
if (gate(flags => flags.enableUnifiedSyncLane)) {
300-
expect(ops).toEqual(['ABC', 'ABCD']);
301-
} else {
302-
expect(ops).toEqual(['BC', 'ABCD']);
303-
}
288+
expect(ops).toEqual(['ABC', 'ABCD']);
304289
});
305290

306291
// @gate www

packages/react-reconciler/src/ReactFiberLane.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
enableUpdaterTracking,
2424
allowConcurrentByDefault,
2525
enableTransitionTracing,
26-
enableUnifiedSyncLane,
2726
} from 'shared/ReactFeatureFlags';
2827
import {isDevToolsPresent} from './ReactFiberDevToolsHook';
2928
import {ConcurrentUpdatesByDefaultMode, NoMode} from './ReactTypeOfMode';
@@ -136,11 +135,9 @@ let nextTransitionLane: Lane = TransitionLane1;
136135
let nextRetryLane: Lane = RetryLane1;
137136

138137
function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
139-
if (enableUnifiedSyncLane) {
140-
const pendingSyncLanes = lanes & SyncUpdateLanes;
141-
if (pendingSyncLanes !== 0) {
142-
return pendingSyncLanes;
143-
}
138+
const pendingSyncLanes = lanes & SyncUpdateLanes;
139+
if (pendingSyncLanes !== NoLanes) {
140+
return pendingSyncLanes;
144141
}
145142
switch (getHighestPriorityLane(lanes)) {
146143
case SyncHydrationLane:
@@ -759,7 +756,7 @@ export function getBumpedLaneForHydration(
759756
const renderLane = getHighestPriorityLane(renderLanes);
760757

761758
let lane;
762-
if (enableUnifiedSyncLane && (renderLane & SyncUpdateLanes) !== NoLane) {
759+
if ((renderLane & SyncUpdateLanes) !== NoLane) {
763760
lane = SyncHydrationLane;
764761
} else {
765762
switch (renderLane) {

packages/react-reconciler/src/__tests__/ReactBatching-test.internal.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,7 @@ describe('ReactBlockingMode', () => {
158158
);
159159

160160
// Now flush the first update
161-
if (gate(flags => flags.enableUnifiedSyncLane)) {
162-
expect(Scheduler).toHaveYielded(['A1', 'B1']);
163-
expect(root).toMatchRenderedOutput('A1B1');
164-
} else {
165-
// Only the second update should have flushed synchronously
166-
expect(Scheduler).toHaveYielded(['B1']);
167-
expect(root).toMatchRenderedOutput('A0B1');
168-
169-
// Now flush the first update
170-
expect(Scheduler).toFlushAndYield(['A1']);
171-
expect(root).toMatchRenderedOutput('A1B1');
172-
}
161+
expect(Scheduler).toHaveYielded(['A1', 'B1']);
162+
expect(root).toMatchRenderedOutput('A1B1');
173163
});
174164
});

packages/react-reconciler/src/__tests__/ReactClassSetStateCallback-test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,11 @@ describe('ReactClassSetStateCallback', () => {
3535
expect(Scheduler).toHaveYielded([0]);
3636

3737
await act(async () => {
38-
if (gate(flags => flags.enableUnifiedSyncLane)) {
39-
React.startTransition(() => {
40-
app.setState({step: 1}, () =>
41-
Scheduler.unstable_yieldValue('Callback 1'),
42-
);
43-
});
44-
} else {
38+
React.startTransition(() => {
4539
app.setState({step: 1}, () =>
4640
Scheduler.unstable_yieldValue('Callback 1'),
4741
);
48-
}
42+
});
4943
ReactNoop.flushSync(() => {
5044
app.setState({step: 2}, () =>
5145
Scheduler.unstable_yieldValue('Callback 2'),

packages/react-reconciler/src/__tests__/ReactFlushSync-test.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,13 @@ describe('ReactFlushSync', () => {
5454
// The passive effect will schedule a sync update and a normal update.
5555
// They should commit in two separate batches. First the sync one.
5656
expect(() => {
57-
expect(Scheduler).toFlushUntilNextPaint(
58-
gate(flags => flags.enableUnifiedSyncLane) ? ['1, 1'] : ['1, 0'],
59-
);
57+
expect(Scheduler).toFlushUntilNextPaint(['1, 1']);
6058
}).toErrorDev('flushSync was called from inside a lifecycle method');
6159

62-
// The remaining update is not sync
60+
// No remaining update
6361
ReactNoop.flushSync();
6462
expect(Scheduler).toHaveYielded([]);
65-
66-
if (gate(flags => flags.enableUnifiedSyncLane)) {
67-
expect(Scheduler).toFlushUntilNextPaint([]);
68-
} else {
69-
// Now flush it.
70-
expect(Scheduler).toFlushUntilNextPaint(['1, 1']);
71-
}
63+
expect(Scheduler).toFlushUntilNextPaint([]);
7264
});
7365
expect(root).toMatchRenderedOutput('1, 1');
7466
});

packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -568,13 +568,9 @@ describe('ReactHooks', () => {
568568
});
569569
};
570570

571-
if (gate(flags => flags.enableUnifiedSyncLane)) {
572-
// Update at transition priority
573-
React.startTransition(() => update(n => n * 100));
574-
} else {
575-
// Update at normal priority
576-
ReactTestRenderer.unstable_batchedUpdates(() => update(n => n * 100));
577-
}
571+
// Update at transition priority
572+
React.startTransition(() => update(n => n * 100));
573+
578574
// The new state is eagerly computed.
579575
expect(Scheduler).toHaveYielded(['Compute state (1 -> 100)']);
580576

packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -961,15 +961,8 @@ describe('ReactHooksWithNoopRenderer', () => {
961961
ReactNoop.flushSync(() => {
962962
counter.current.dispatch(INCREMENT);
963963
});
964-
if (gate(flags => flags.enableUnifiedSyncLane)) {
965-
expect(Scheduler).toHaveYielded(['Count: 4']);
966-
expect(ReactNoop.getChildren()).toEqual([span('Count: 4')]);
967-
} else {
968-
expect(Scheduler).toHaveYielded(['Count: 1']);
969-
expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);
970-
expect(Scheduler).toFlushAndYield(['Count: 4']);
971-
expect(ReactNoop.getChildren()).toEqual([span('Count: 4')]);
972-
}
964+
expect(Scheduler).toHaveYielded(['Count: 4']);
965+
expect(ReactNoop.getChildren()).toEqual([span('Count: 4')]);
973966
});
974967
});
975968

@@ -1727,15 +1720,7 @@ describe('ReactHooksWithNoopRenderer', () => {
17271720
// As a result we, somewhat surprisingly, commit them in the opposite order.
17281721
// This should be fine because any non-discrete set of work doesn't guarantee order
17291722
// and easily could've happened slightly later too.
1730-
if (gate(flags => flags.enableUnifiedSyncLane)) {
1731-
expect(Scheduler).toHaveYielded(['Will set count to 1', 'Count: 1']);
1732-
} else {
1733-
expect(Scheduler).toHaveYielded([
1734-
'Will set count to 1',
1735-
'Count: 2',
1736-
'Count: 1',
1737-
]);
1738-
}
1723+
expect(Scheduler).toHaveYielded(['Will set count to 1', 'Count: 1']);
17391724

17401725
expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);
17411726
});

0 commit comments

Comments
 (0)