mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
SchedulerMock.unstable_yieldValue -> SchedulerMock.log (#26312)
(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.
This commit is contained in:
@@ -77,7 +77,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
|
||||
});
|
||||
|
||||
function Text({text}) {
|
||||
Scheduler.unstable_yieldValue(text);
|
||||
Scheduler.log(text);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
});
|
||||
|
||||
function Text({text}) {
|
||||
Scheduler.unstable_yieldValue(text);
|
||||
Scheduler.log(text);
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
function App() {
|
||||
const value = useSyncExternalStore(store.subscribe, store.getState);
|
||||
useEffect(() => {
|
||||
Scheduler.unstable_yieldValue('Passive effect: ' + value);
|
||||
Scheduler.log('Passive effect: ' + value);
|
||||
}, [value]);
|
||||
return <Text text={value} />;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
// that changed the getSnapshot in Child2. Child2's effects haven't
|
||||
// fired yet, so it doesn't have access to the latest getSnapshot. So
|
||||
// it can't use the getSnapshot to bail out.
|
||||
Scheduler.unstable_yieldValue('Update B in commit phase');
|
||||
Scheduler.log('Update B in commit phase');
|
||||
store.set({a: value.a, b: 2});
|
||||
}
|
||||
}, [step]);
|
||||
@@ -397,7 +397,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
// that changed the getSnapshot in Child2. Child2's effects haven't
|
||||
// fired yet, so it doesn't have access to the latest getSnapshot. So
|
||||
// it can't use the getSnapshot to bail out.
|
||||
Scheduler.unstable_yieldValue('Update B in commit phase');
|
||||
Scheduler.log('Update B in commit phase');
|
||||
store.set({a: value.a, b: 2});
|
||||
}
|
||||
}, [step]);
|
||||
@@ -449,7 +449,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
const value = useSyncExternalStore(store.subscribe, store.getState);
|
||||
useLayoutEffect(() => {
|
||||
if (value === 1) {
|
||||
Scheduler.unstable_yieldValue('Reset back to 0');
|
||||
Scheduler.log('Reset back to 0');
|
||||
store.set(0);
|
||||
}
|
||||
}, [value]);
|
||||
@@ -629,12 +629,12 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
const store = createExternalStore({a: 0, b: 0});
|
||||
|
||||
function selector(state) {
|
||||
Scheduler.unstable_yieldValue('Selector');
|
||||
Scheduler.log('Selector');
|
||||
return state.a;
|
||||
}
|
||||
|
||||
function App() {
|
||||
Scheduler.unstable_yieldValue('App');
|
||||
Scheduler.log('App');
|
||||
const a = useSyncExternalStoreWithSelector(
|
||||
store.subscribe,
|
||||
store.getState,
|
||||
@@ -738,7 +738,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
() => 'server',
|
||||
);
|
||||
useEffect(() => {
|
||||
Scheduler.unstable_yieldValue('Passive effect: ' + text);
|
||||
Scheduler.log('Passive effect: ' + text);
|
||||
}, [text]);
|
||||
return (
|
||||
<div ref={ref}>
|
||||
@@ -838,7 +838,7 @@ describe('Shared useSyncExternalStore behavior (shim and built-in)', () => {
|
||||
|
||||
function App({step}) {
|
||||
const inlineSelector = state => {
|
||||
Scheduler.unstable_yieldValue('Inline selector');
|
||||
Scheduler.log('Inline selector');
|
||||
return [...state.items, 'C'];
|
||||
};
|
||||
const items = useSyncExternalStoreWithSelector(
|
||||
|
||||
@@ -54,7 +54,7 @@ describe('useSyncExternalStore (userspace shim, server rendering)', () => {
|
||||
});
|
||||
|
||||
function Text({text}) {
|
||||
Scheduler.unstable_yieldValue(text);
|
||||
Scheduler.log(text);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user