Skip to content

Commit

Permalink
Add UnknownLane and flush unknown updates in a rAF
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed May 22, 2022
1 parent 6e2f38f commit 3fd61cb
Show file tree
Hide file tree
Showing 33 changed files with 585 additions and 288 deletions.
10 changes: 10 additions & 0 deletions packages/jest-react/src/internalAct.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
// migrate existing tests.
let didFlushWork;
do {
// Flush scheduled rAF.
if (global.flushRequestAnimationFrameQueue) {
global.flushRequestAnimationFrameQueue();
}

didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
} while (didFlushWork);
return {
Expand All @@ -120,6 +125,11 @@ export function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
}

function flushActWork(resolve, reject) {
// Flush scheduled rAF.
if (global.flushRequestAnimationFrameQueue) {
global.flushRequestAnimationFrameQueue();
}

// Flush suspended fallbacks
// $FlowFixMe: Flow doesn't know about global Jest object
jest.runOnlyPendingTimers();
Expand Down
317 changes: 162 additions & 155 deletions packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js

Large diffs are not rendered by default.

0 comments on commit 3fd61cb

Please sign in to comment.