Skip to content

Commit 7a36dfe

Browse files
authored
[Fizz] Delay retrying hydration until after an animation frame (facebook#34220)
The theory here is that when we reveal a boundary coming from the server we want to paint that before hydrating it. Hydration gets scheduled in a macrotask with the scheduler but it's in theory possible that it runs before the paint. If that's the case, then the JS that runs before yielding during hydration might slightly delay the paint and we might miss a window to skip the previous paint.
1 parent 546bac7 commit 7a36dfe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function revealCompletedBoundaries(batch) {
9494

9595
suspenseNode.data = SUSPENSE_START_DATA;
9696
if (suspenseNode['_reactRetry']) {
97-
suspenseNode['_reactRetry']();
97+
requestAnimationFrame(suspenseNode['_reactRetry']);
9898
}
9999
}
100100
batch.length = 0;

0 commit comments

Comments
 (0)