Skip to content

Commit cb2d008

Browse files
committed
SchedulerMock.unstable_yieldValue -> SchedulerMock.log
(This only affects our own internal repo; it's not a public API.) I think most of us agree this is a less confusing name. It's possible someone will confuse it with `console.log`. If that becomes a problem we can warn in dev or something.
1 parent 0cba581 commit cb2d008

File tree

88 files changed

+1989
-2519
lines changed

Some content is hidden

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

88 files changed

+1989
-2519
lines changed

packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Scheduler = require('scheduler/unstable_mock');
2626
describe('ReactInternalTestUtils', () => {
2727
test('waitFor', async () => {
2828
const Yield = ({id}) => {
29-
Scheduler.unstable_yieldValue(id);
29+
Scheduler.log(id);
3030
return id;
3131
};
3232

@@ -51,7 +51,7 @@ describe('ReactInternalTestUtils', () => {
5151

5252
test('waitForAll', async () => {
5353
const Yield = ({id}) => {
54-
Scheduler.unstable_yieldValue(id);
54+
Scheduler.log(id);
5555
return id;
5656
};
5757

@@ -72,7 +72,7 @@ describe('ReactInternalTestUtils', () => {
7272

7373
test('waitForThrow', async () => {
7474
const Yield = ({id}) => {
75-
Scheduler.unstable_yieldValue(id);
75+
Scheduler.log(id);
7676
return id;
7777
};
7878

@@ -113,7 +113,7 @@ describe('ReactInternalTestUtils', () => {
113113
function App({prop}) {
114114
const deferred = useDeferredValue(prop);
115115
const text = `Urgent: ${prop}, Deferred: ${deferred}`;
116-
Scheduler.unstable_yieldValue(text);
116+
Scheduler.log(text);
117117
return text;
118118
}
119119

@@ -137,7 +137,7 @@ describe('ReactInternalTestUtils', () => {
137137

138138
test('assertLog', async () => {
139139
const Yield = ({id}) => {
140-
Scheduler.unstable_yieldValue(id);
140+
Scheduler.log(id);
141141
return id;
142142
};
143143

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,12 @@ describe('ReactCache', () => {
5454
listeners = [{resolve, reject}];
5555
setTimeout(() => {
5656
if (textResourceShouldFail) {
57-
Scheduler.unstable_yieldValue(
58-
`Promise rejected [${text}]`,
59-
);
57+
Scheduler.log(`Promise rejected [${text}]`);
6058
status = 'rejected';
6159
value = new Error('Failed to load: ' + text);
6260
listeners.forEach(listener => listener.reject(value));
6361
} else {
64-
Scheduler.unstable_yieldValue(
65-
`Promise resolved [${text}]`,
66-
);
62+
Scheduler.log(`Promise resolved [${text}]`);
6763
status = 'resolved';
6864
value = text;
6965
listeners.forEach(listener => listener.resolve(value));
@@ -93,21 +89,21 @@ describe('ReactCache', () => {
9389
});
9490

9591
function Text(props) {
96-
Scheduler.unstable_yieldValue(props.text);
92+
Scheduler.log(props.text);
9793
return props.text;
9894
}
9995

10096
function AsyncText(props) {
10197
const text = props.text;
10298
try {
10399
TextResource.read([props.text, props.ms]);
104-
Scheduler.unstable_yieldValue(text);
100+
Scheduler.log(text);
105101
return text;
106102
} catch (promise) {
107103
if (typeof promise.then === 'function') {
108-
Scheduler.unstable_yieldValue(`Suspend! [${text}]`);
104+
Scheduler.log(`Suspend! [${text}]`);
109105
} else {
110-
Scheduler.unstable_yieldValue(`Error! [${text}]`);
106+
Scheduler.log(`Error! [${text}]`);
111107
}
112108
throw promise;
113109
}
@@ -171,7 +167,7 @@ describe('ReactCache', () => {
171167
});
172168

173169
function App() {
174-
Scheduler.unstable_yieldValue('App');
170+
Scheduler.log('App');
175171
return BadTextResource.read(['Hi', 100]);
176172
}
177173

@@ -322,13 +318,13 @@ describe('ReactCache', () => {
322318
const text = props.text;
323319
try {
324320
const actualText = BadTextResource.read([props.text, props.ms]);
325-
Scheduler.unstable_yieldValue(actualText);
321+
Scheduler.log(actualText);
326322
return actualText;
327323
} catch (promise) {
328324
if (typeof promise.then === 'function') {
329-
Scheduler.unstable_yieldValue(`Suspend! [${text}]`);
325+
Scheduler.log(`Suspend! [${text}]`);
330326
} else {
331-
Scheduler.unstable_yieldValue(`Error! [${text}]`);
327+
Scheduler.log(`Error! [${text}]`);
332328
}
333329
throw promise;
334330
}

packages/react-client/src/__tests__/ReactFlight-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ describe('ReactFlight', () => {
799799
}
800800

801801
function ClientDoubler({el}) {
802-
Scheduler.unstable_yieldValue('ClientDoubler');
802+
Scheduler.log('ClientDoubler');
803803
return (
804804
<>
805805
{el}
@@ -990,10 +990,10 @@ describe('ReactFlight', () => {
990990

991991
function Bar() {
992992
if (!promise.unsuspend) {
993-
Scheduler.unstable_yieldValue('suspended');
993+
Scheduler.log('suspended');
994994
throw promise;
995995
}
996-
Scheduler.unstable_yieldValue('rendered');
996+
Scheduler.log('rendered');
997997
const context = React.useContext(ServerContext);
998998
return context;
999999
}
@@ -1027,7 +1027,7 @@ describe('ReactFlight', () => {
10271027
);
10281028

10291029
function ClientBar() {
1030-
Scheduler.unstable_yieldValue('ClientBar');
1030+
Scheduler.log('ClientBar');
10311031
const context = React.useContext(ServerContext);
10321032
return <span>{context}</span>;
10331033
}

0 commit comments

Comments
 (0)