Fix for failed Suspense layout semantics#21694
Conversation
This was preventing layout effects from being recreated within Offscreen subtrees in some conditions.
|
Comparing: a0d2d1e...742d0b0 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
|
That's interesting. We have a slight timing difference for when we destroy the layout effect in production tests too. ReactTestRenderer.act(() => {
_setShow(true);
});
expect(Scheduler).toHaveYielded([
"Child 1",
"Suspend! [Child 2]",
"Loading...",
// In development we destroy it here
"destroy layout",
]);
jest.advanceTimersByTime(1000);
expect(Scheduler).toHaveYielded([
// In production we destroy it here
"destroy layout",
"Promise resolved [Child 2]",
]);I'm not sure why there's a difference in these two behaviors. I would not expect there to be. Looking at the stack, I see the following frames in DEV mode: But in production mode I see: So for some reason, it looks like In Dev, higher up in the call stack is |
Summary: This sync includes the following changes: - **[43f4cc1](facebook/react@43f4cc160 )**: Fix failing test ([#21697](facebook/react#21697)) //<Dan Abramov>// - **[d0f348d](facebook/react@d0f348dc1 )**: Fix for failed Suspense layout semantics ([#21694](facebook/react#21694)) //<Brian Vaughn>// - **[bd0a963](facebook/react@bd0a96344 )**: Throw when `act` is used in production ([#21686](facebook/react#21686)) //<Andrew Clark>// - **[9343f87](facebook/react@9343f8720 )**: Use the server src files as entry points for the builds/tests ([#21683](facebook/react#21683)) //<Sebastian Markbåge>// - **[502f8a2](facebook/react@502f8a2a0 )**: [Fizz/Flight] Don't use default args ([#21681](facebook/react#21681)) //<Sebastian Markbåge>// - **[a8f5e77](facebook/react@a8f5e77b9 )**: Remove invokeGuardedCallback from commit phase ([#21666](facebook/react#21666)) //<Dan Abramov>// - **[dbe3363](facebook/react@dbe3363cc )**: [Fizz] Implement Legacy renderToString and renderToNodeStream on top of Fizz ([#21276](facebook/react#21276)) //<Sebastian Markbåge>// - **[101ea9f](facebook/react@101ea9f55 )**: Set deletedTreeCleanUpLevel to 3 ([#21679](facebook/react#21679)) //<Dan Abramov>// - **[1a106bd](facebook/react@1a106bdc2 )**: Wrap eventhandle-specific logic in a flag ([#21657](facebook/react#21657)) //<Dan Abramov>// - **[cb30388](facebook/react@cb30388d1 )**: Export React Native `AttributeType` Types ([#21661](facebook/react#21661)) //<Timothy Yung>// - **[c153679](facebook/react@c1536795c )**: Revert "Make enableSuspenseLayoutEffectSemantics static for www ([#21617](facebook/react#21617))" ([#21656](facebook/react#21656)) //<Sebastian Markbåge>// Changelog: [General][Changed] - React Native sync for revisions c96b78e...568dc35 jest_e2e[run_all_tests] Reviewed By: rickhanlonii Differential Revision: D29303157 fbshipit-source-id: 90952885eb2264f4effa04070357b80700bb9be3
Resolves #21676. Fixes failing test added in #21677
When adding the new Suspense/Offscreen effects semantics, we intentionally left out the
subtreeFlagschecks since these values aren't 100% reliable and the check is just an optimization. (Refer to the// TODO (Offscreen)comments in the source code.)It looks like #21386 (re)added one though, which was causing a failure case originally reported here:
reactwg/react-18#31
For now, this PR just removes that check and adds a follow up TODO comment. This is just a bandaid fix to allow us to resume rolling out the new Suspense layout semantics. A proper long-term fix would be to identify why the
subtreeFlagsare incorrect in this case.