Skip to content

Commit a67ce79

Browse files
committed
Update error recovery test to match new semantics
1 parent e86693f commit a67ce79

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,20 @@ describe('ReactIncrementalErrorHandling', () => {
243243
// This update is in a separate batch
244244
ReactNoop.render(<App isBroken={false} />, onCommit);
245245

246-
expect(Scheduler).toFlushAndYield([
246+
expect(Scheduler).toFlushAndYieldThrough([
247247
// The first render fails. But because there's a lower priority pending
248248
// update, it doesn't throw.
249249
'error',
250-
// Now we retry at the lower priority. This time it succeeds.
250+
]);
251+
252+
// React will try to recover by rendering all the pending updates in a
253+
// single batch, synchronously. This time it succeeds.
254+
//
255+
// This tells Scheduler to render a single unit of work. Because the render
256+
// to recover from the error is synchronous, this should be enough to
257+
// finish the rest of the work.
258+
Scheduler.unstable_flushNumberOfYields(1);
259+
expect(Scheduler).toHaveYielded([
251260
'success',
252261
// Nothing commits until the second update completes.
253262
'commit',
@@ -296,10 +305,6 @@ describe('ReactIncrementalErrorHandling', () => {
296305
expect(ReactNoop.getChildren()).toEqual([]);
297306
});
298307

299-
// TODO: This is currently unobservable, but will be once we lift renderRoot
300-
// and commitRoot into the renderer.
301-
// it("does not retry synchronously if there's an update between complete and commit");
302-
303308
it('calls componentDidCatch multiple times for multiple errors', () => {
304309
let id = 0;
305310
class BadMount extends React.Component {

0 commit comments

Comments
 (0)