From 6fbe630549de1ea7d2c34752880459f854c4440d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Tue, 13 Aug 2019 18:26:21 -0700 Subject: [PATCH] [Partial Hydration] Attempt hydration at a higher pri first if props/context changes (#16352) * Test that we can suspend updates while waiting to hydrate * Attempt hydration at a higher pri first if props/context changes * Retrying a dehydrated boundary pings at the earliest forced time This might quickly become an already expired time. * Mark the render as delayed if we have to retry This allows the suspense config to kick in and we can wait for much longer before we're forced to give up on hydrating. --- fixtures/ssr/src/components/Chrome.js | 11 +- ...DOMServerPartialHydration-test.internal.js | 184 ++++++++++++++++-- .../src/ReactFiberBeginWork.js | 39 +++- .../src/ReactFiberHydrationContext.js | 2 + .../src/ReactFiberSuspenseComponent.js | 4 + .../src/ReactFiberWorkLoop.js | 36 +++- 6 files changed, 248 insertions(+), 28 deletions(-) diff --git a/fixtures/ssr/src/components/Chrome.js b/fixtures/ssr/src/components/Chrome.js index b52c8d0ee74d4..5bad11aae5a27 100644 --- a/fixtures/ssr/src/components/Chrome.js +++ b/fixtures/ssr/src/components/Chrome.js @@ -26,7 +26,16 @@ export default class Chrome extends Component { {this.props.children}
- this.setState({theme})} /> + { + React.unstable_withSuspenseConfig( + () => { + this.setState({theme}); + }, + {timeoutMs: 6000} + ); + }} + />