Skip to content

Commit

Permalink
Adjust for enableUnifiedSyncLane that makes DefaultLane non-blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Apr 10, 2024
1 parent d69959f commit f5663e5
Show file tree
Hide file tree
Showing 15 changed files with 541 additions and 19 deletions.
Expand Up @@ -102,7 +102,17 @@ describe('ReactInternalTestUtils', () => {
root.render(<App />);

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

test('waitForPaint', 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]']);
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
12 changes: 12 additions & 0 deletions packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
Expand Up @@ -1186,6 +1186,12 @@ describe('ReactCompositeComponent', () => {
}).toErrorDev([
'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 @@ -1224,6 +1230,12 @@ describe('ReactCompositeComponent', () => {
}).toErrorDev([
'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
51 changes: 51 additions & 0 deletions packages/react-dom/src/__tests__/ReactDOMSelect-test.js
Expand Up @@ -1297,6 +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.',
...(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 @@ -1320,6 +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.',
...(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 @@ -1344,6 +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.',
...(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 @@ -1476,6 +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.',
...(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 @@ -1500,6 +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.',
...(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 @@ -1523,6 +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.',
...(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 @@ -1557,6 +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.',
...(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 @@ -1593,6 +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.',
...(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
2 changes: 2 additions & 0 deletions packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
Expand Up @@ -672,6 +672,8 @@ 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>.',
!gate(flags => flags.enableUnifiedSyncLane) &&
'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
]);

let node;
Expand Down

0 comments on commit f5663e5

Please sign in to comment.