Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconciler: Don't retry synchronous render #28810

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -111,9 +111,13 @@ describe('ReactInternalTestUtils', () => {
assertLog([
'A',
'B',
// React will try one more time before giving up.
'A',
'B',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
// React will try one more time in non-blocking updates before giving up.
'A',
'B',
]),
]);
});

Expand Down Expand Up @@ -748,7 +752,17 @@ describe('ReactInternalTestUtils console assertions', () => {
You must call one of the assertConsoleDev helpers between each act call."
`);

await waitForAll(['A', 'B', 'A', 'B']);
await waitForAll([
'A',
'B',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
// React will try one more time in non-blocking updates before giving up.
'A',
'B',
]),
]);
});

test('should fail if waitForPaint is called before asserting', async () => {
Expand Down Expand Up @@ -1680,7 +1694,17 @@ describe('ReactInternalTestUtils console assertions', () => {
You must call one of the assertConsoleDev helpers between each act call."
`);

await waitForAll(['A', 'B', 'A', 'B']);
await waitForAll([
'A',
'B',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
// React will try one more time in non-blocking updates before giving up.
'A',
'B',
]),
]);
});

test('should fail if waitForPaint is called before asserting', async () => {
Expand Down Expand Up @@ -2630,7 +2654,17 @@ describe('ReactInternalTestUtils console assertions', () => {
You must call one of the assertConsoleDev helpers between each act call."
`);

await waitForAll(['A', 'B', 'A', 'B']);
await waitForAll([
'A',
'B',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
// React will try one more time in non-blocking updates before giving up.
'A',
'B',
]),
]);
});

test('should fail if waitForPaint is called before asserting', async () => {
Expand Down
Expand Up @@ -153,7 +153,11 @@ describe('ReactCache', () => {
// Should throw again on a subsequent read
root.render(<App />);
await waitForThrow('Failed to load: Hi');
assertLog(['Error! [Hi]', 'Error! [Hi]']);
assertLog(
gate(flags => flags.enableUnifiedSyncLane)
? ['Error! [Hi]']
: ['Error! [Hi]', 'Error! [Hi]'],
);
});

it('warns if non-primitive key is passed to a resource without a hash function', async () => {
Expand Down
2,302 changes: 1,136 additions & 1,166 deletions packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js

Large diffs are not rendered by default.

Expand Up @@ -1792,7 +1792,7 @@ describe('Timeline profiler', () => {
testMarks.push(...createUserTimingData(clearedMarks));

const data = await preprocessData(testMarks);
expect(data.thrownErrors).toHaveLength(2);
expect(data.thrownErrors).toHaveLength(1);
expect(data.thrownErrors[0].message).toMatchInlineSnapshot(
'"Expected error"',
);
Expand Down
16 changes: 12 additions & 4 deletions packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
Expand Up @@ -1186,8 +1186,12 @@ describe('ReactCompositeComponent', () => {
}).toErrorDev([
'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
'did you accidentally return an object from the constructor?',
'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
'did you accidentally return an object from the constructor?',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
'did you accidentally return an object from the constructor?',
]),
]);
});

Expand Down Expand Up @@ -1226,8 +1230,12 @@ describe('ReactCompositeComponent', () => {
}).toErrorDev([
'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
'you may have forgotten to define `render`.',
'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
'you may have forgotten to define `render`.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
'you may have forgotten to define `render`.',
]),
]);
});

Expand Down
70 changes: 51 additions & 19 deletions packages/react-dom/src/__tests__/ReactDOMSelect-test.js
Expand Up @@ -1297,9 +1297,13 @@ describe('ReactDOMSelect', () => {
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
]),
]);
});

Expand All @@ -1323,8 +1327,12 @@ describe('ReactDOMSelect', () => {
}).toErrorDev([
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
]),
]);
});

Expand All @@ -1349,8 +1357,12 @@ describe('ReactDOMSelect', () => {
}).toErrorDev([
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
]),
]);
});

Expand Down Expand Up @@ -1483,9 +1495,13 @@ describe('ReactDOMSelect', () => {
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
]),
]);
});

Expand All @@ -1510,8 +1526,12 @@ describe('ReactDOMSelect', () => {
}).toErrorDev([
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
]),
]);
});

Expand All @@ -1535,8 +1555,12 @@ describe('ReactDOMSelect', () => {
}).toErrorDev([
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
]),
]);
});

Expand Down Expand Up @@ -1571,9 +1595,13 @@ describe('ReactDOMSelect', () => {
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before using it here.',
]),
]);
});

Expand Down Expand Up @@ -1610,8 +1638,12 @@ describe('ReactDOMSelect', () => {
}).toErrorDev([
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before using it here.',
]),
]);
});

Expand Down
6 changes: 5 additions & 1 deletion packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
Expand Up @@ -672,7 +672,11 @@ describe('ReactDOMTextarea', () => {
}).rejects.toThrow('<textarea> can only have at most one child');
}).toErrorDev([
'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
...(gate(flags => flags.enableUnifiedSyncLane)
? []
: [
'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
]),
]);

let node;
Expand Down