Skip to content

Commit b8b7566

Browse files
committed
Remove invokeGuardedCallback and replay trick
1 parent 706d95f commit b8b7566

File tree

54 files changed

+253
-1419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+253
-1419
lines changed

fixtures/dom/src/toWarnDev.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ const util = require('util');
77
function shouldIgnoreConsoleError(format, args) {
88
if (__DEV__) {
99
if (typeof format === 'string') {
10-
if (format.indexOf('Error: Uncaught [') === 0) {
11-
// This looks like an uncaught error from invokeGuardedCallback() wrapper
12-
// in development that is reported by jsdom. Ignore because it's noisy.
13-
return true;
14-
}
1510
if (format.indexOf('The above error occurred') === 0) {
1611
// This looks like an error addendum from ReactFiberErrorLogger.
1712
// Ignore it too.

packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
let ReactCache;
1313
let createResource;
1414
let React;
15-
let ReactFeatureFlags;
1615
let ReactNoop;
1716
let Scheduler;
1817
let Suspense;
@@ -27,9 +26,6 @@ describe('ReactCache', () => {
2726
beforeEach(() => {
2827
jest.resetModules();
2928

30-
ReactFeatureFlags = require('shared/ReactFeatureFlags');
31-
32-
ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false;
3329
React = require('react');
3430
Suspense = React.Suspense;
3531
ReactCache = require('react-cache');

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('InvalidEventListeners', () => {
4343
);
4444
const node = container.firstChild;
4545

46-
spyOnProd(console, 'error');
46+
console.error = jest.fn();
4747

4848
const uncaughtErrors = [];
4949
function handleWindowError(e) {
@@ -70,18 +70,16 @@ describe('InvalidEventListeners', () => {
7070
}),
7171
);
7272

73-
if (!__DEV__) {
74-
expect(console.error).toHaveBeenCalledTimes(1);
75-
expect(console.error.mock.calls[0][0]).toEqual(
76-
expect.objectContaining({
77-
detail: expect.objectContaining({
78-
message:
79-
'Expected `onClick` listener to be a function, instead got a value of `string` type.',
80-
}),
81-
type: 'unhandled exception',
73+
expect(console.error).toHaveBeenCalledTimes(1);
74+
expect(console.error.mock.calls[0][0]).toEqual(
75+
expect.objectContaining({
76+
detail: expect.objectContaining({
77+
message:
78+
'Expected `onClick` listener to be a function, instead got a value of `string` type.',
8279
}),
83-
);
84-
}
80+
type: 'unhandled exception',
81+
}),
82+
);
8583
});
8684

8785
it('should not prevent null listeners, at dispatch', async () => {

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,13 +1231,6 @@ describe('ReactCompositeComponent', () => {
12311231
});
12321232
}).toThrow();
12331233
}).toErrorDev([
1234-
// Expect two errors because invokeGuardedCallback will dispatch an error event,
1235-
// Causing the warning to be logged again.
1236-
'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
1237-
'did you accidentally return an object from the constructor?',
1238-
'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
1239-
'did you accidentally return an object from the constructor?',
1240-
// And then two more because we retry errors.
12411234
'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
12421235
'did you accidentally return an object from the constructor?',
12431236
'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
@@ -1278,14 +1271,6 @@ describe('ReactCompositeComponent', () => {
12781271
});
12791272
}).toThrow();
12801273
}).toErrorDev([
1281-
// Expect two errors because invokeGuardedCallback will dispatch an error event,
1282-
// Causing the warning to be logged again.
1283-
'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
1284-
'you may have forgotten to define `render`.',
1285-
'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
1286-
'you may have forgotten to define `render`.',
1287-
1288-
// And then two more because we retry errors.
12891274
'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
12901275
'you may have forgotten to define `render`.',
12911276
'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +

0 commit comments

Comments
 (0)