Skip to content

Commit 7e7fdd0

Browse files
author
Jack Pope
committed
Fix ReactIncrementalUpdates-test
1 parent 9564fcd commit 7e7fdd0

File tree

1 file changed

+17
-58
lines changed

1 file changed

+17
-58
lines changed

Diff for: packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js

+17-58
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,11 @@ describe('ReactIncrementalUpdates', () => {
156156
}
157157

158158
// Schedule some async updates
159-
if (gate(flags => !flags.forceConcurrentByDefaultForTesting)) {
160-
React.startTransition(() => {
161-
instance.setState(createUpdate('a'));
162-
instance.setState(createUpdate('b'));
163-
instance.setState(createUpdate('c'));
164-
});
165-
} else {
159+
React.startTransition(() => {
166160
instance.setState(createUpdate('a'));
167161
instance.setState(createUpdate('b'));
168162
instance.setState(createUpdate('c'));
169-
}
163+
});
170164

171165
// Begin the updates but don't flush them yet
172166
await waitFor(['a', 'b', 'c']);
@@ -183,14 +177,8 @@ describe('ReactIncrementalUpdates', () => {
183177
});
184178

185179
// The sync updates should have flushed, but not the async ones.
186-
if (gate(flags => !flags.forceConcurrentByDefaultForTesting)) {
187-
assertLog(['d', 'e', 'f']);
188-
expect(ReactNoop).toMatchRenderedOutput(<span prop="def" />);
189-
} else {
190-
// Update d was dropped and replaced by e.
191-
assertLog(['e', 'f']);
192-
expect(ReactNoop).toMatchRenderedOutput(<span prop="ef" />);
193-
}
180+
assertLog(['d', 'e', 'f']);
181+
expect(ReactNoop).toMatchRenderedOutput(<span prop="def" />);
194182

195183
// Now flush the remaining work. Even though e and f were already processed,
196184
// they should be processed again, to ensure that the terminal state
@@ -231,17 +219,11 @@ describe('ReactIncrementalUpdates', () => {
231219
}
232220

233221
// Schedule some async updates
234-
if (gate(flags => !flags.forceConcurrentByDefaultForTesting)) {
235-
React.startTransition(() => {
236-
instance.setState(createUpdate('a'));
237-
instance.setState(createUpdate('b'));
238-
instance.setState(createUpdate('c'));
239-
});
240-
} else {
222+
React.startTransition(() => {
241223
instance.setState(createUpdate('a'));
242224
instance.setState(createUpdate('b'));
243225
instance.setState(createUpdate('c'));
244-
}
226+
});
245227

246228
// Begin the updates but don't flush them yet
247229
await waitFor(['a', 'b', 'c']);
@@ -261,45 +243,22 @@ describe('ReactIncrementalUpdates', () => {
261243
});
262244

263245
// The sync updates should have flushed, but not the async ones.
264-
if (gate(flags => !flags.forceConcurrentByDefaultForTesting)) {
265-
assertLog(['d', 'e', 'f']);
266-
} else {
267-
// Update d was dropped and replaced by e.
268-
assertLog(['e', 'f']);
269-
}
246+
assertLog(['d', 'e', 'f']);
270247
expect(ReactNoop).toMatchRenderedOutput(<span prop="f" />);
271248

272249
// Now flush the remaining work. Even though e and f were already processed,
273250
// they should be processed again, to ensure that the terminal state
274251
// is deterministic.
275-
if (gate(flags => !flags.forceConcurrentByDefaultForTesting)) {
276-
await waitForAll([
277-
// Since 'g' is in a transition, we'll process 'd' separately first.
278-
// That causes us to process 'd' with 'e' and 'f' rebased.
279-
'd',
280-
'e',
281-
'f',
282-
// Then we'll re-process everything for 'g'.
283-
'a',
284-
'b',
285-
'c',
286-
'd',
287-
'e',
288-
'f',
289-
'g',
290-
]);
291-
} else {
292-
await waitForAll([
293-
// Then we'll re-process everything for 'g'.
294-
'a',
295-
'b',
296-
'c',
297-
'd',
298-
'e',
299-
'f',
300-
'g',
301-
]);
302-
}
252+
await waitForAll([
253+
// Then we'll re-process everything for 'g'.
254+
'a',
255+
'b',
256+
'c',
257+
'd',
258+
'e',
259+
'f',
260+
'g',
261+
]);
303262
expect(ReactNoop).toMatchRenderedOutput(<span prop="fg" />);
304263
});
305264

0 commit comments

Comments
 (0)