@samitouri / QOS-React-2 / commits / 47ff31a77a

Revert "Add regression test for #18497 (#18538)" (#19215)

This reverts commit e9c1445ba09ac0ae73465f28514f9aa45074b7c7.

Dan Abramov committed Jun 30, 2020 at 13:38 UTC 47ff31a77add22bef54aaed9d4fb62d5aa693afd
2 files changed +1 -43
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
-40
@@ -3314,44 +3314,4 @@ describe('ReactHooksWithNoopRenderer', () => {
3314 });
3315 expect(ReactNoop).toMatchRenderedOutput('ABC');
3316 });
3317 -
3318 - it('keeps intermediate state updates (issue #18497)', () => {
3319 - let _dispatch;
3320 - function Counter() {
3321 - const [list, dispatch] = React.useReducer((l, c) => l.concat([c]), []);
3322 - _dispatch = dispatch;
3323 -
3324 - const json = JSON.stringify(list);
3325 - Scheduler.unstable_yieldValue('Render ' + json);
3326 - useLayoutEffect(() => {
3327 - Scheduler.unstable_yieldValue('Commit ' + json);
3328 - });
3329 -
3330 - return json;
3331 - }
3332 -
3333 - act(() => {
3334 - ReactNoop.render(<Counter />);
3335 - expect(Scheduler).toFlushAndYieldThrough(['Render []', 'Commit []']);
3336 - expect(ReactNoop).toMatchRenderedOutput('[]');
3337 - });
3338 -
3339 - act(() => {
3340 - _dispatch(1);
3341 - expect(Scheduler).toFlushAndYieldThrough(['Render [1]']);
3342 -
3343 - _dispatch(2);
3344 - expect(Scheduler).toFlushAndYieldThrough(['Commit [1]']);
3345 - expect(ReactNoop).toMatchRenderedOutput('[1]');
3346 -
3347 - expect(Scheduler).toFlushAndYieldThrough(['Render [1,2]']);
3348 - _dispatch(3);
3349 -
3350 - expect(Scheduler).toFlushAndYieldThrough([
3351 - 'Render [1,2,3]',
3352 - 'Commit [1,2,3]',
3353 - ]);
3354 - expect(ReactNoop).toMatchRenderedOutput('[1,2,3]');
3355 - });
3356 - });
3317 });
scripts/jest/matchers/schedulerTestMatchers.js
+1 -3
@@ -20,9 +20,7 @@ function assertYieldsWereCleared(Scheduler) {
20 const actualYields = Scheduler.unstable_clearYields();
21 if (actualYields.length !== 0) {
22 throw new Error(
23 - 'Log of yielded values is not empty: ' +
24 - JSON.stringify(actualYields) +
25 - '. ' +
23 + 'Log of yielded values is not empty. ' +
24 'Call expect(Scheduler).toHaveYielded(...) first.'
25 );
26 }