Commit 3cfcdfb
[Flight] Resolve Deep Cycles (#33664)
Stacked on #33666.
If we ever get a future reference to a cycle and that reference gets
eagerly parsed before the target has loaded then we can end up with a
cycle that never gets resolved. That's because our cycle resolution only
works if the cyclic future reference is created synchronously within the
parsing path of the child.
I haven't been able to construct a normal scenario where this would
break. So this doesn't fail any tests. However, I can construct it with
debug info since those are eagerly evaluated. It's also a prerequisite
if the debug data can come out of order, like if it's on a different
stream.
The fix here is to make all the internal dependencies in the "listener"
list into introspectable objects instead of closures. That way we can
traverse the list of dependencies of a blocked reference to see if it
ends up in a cycle and therefore skip the reference.
It would be nice to address this once and for all to be more resilient
to server changes, but I'm not sure if it's worth this complexity and
the extra CPU cost of tracing the dependencies. Especially if it's just
for debug data.
closes #32316
fixes vercel/next.js#72104
---------
Co-authored-by: Hendrik Liebau <[email protected]>1 parent 9c2a8dd commit 3cfcdfb
File tree
2 files changed
+422
-162
lines changed- packages
- react-client/src
- react-server-dom-webpack/src/__tests__
2 files changed
+422
-162
lines changed
0 commit comments