react icon indicating copy to clipboard operation
react copied to clipboard

[Fax] Support nesting in existing RSC renderers

Open eps1lon opened this issue 1 year ago • 6 comments

Summary

This chains the async dispatchers similarly to what we did https://github.com/facebook/react/pull/28488.

The cache between nested renderers is shared prioritising the one that was first registered during module evaluation (an earlier version cached in both but I couldn't think of a case where we need this behavior).

Parent stacks and Owner stacks currently don't work in onError of react-markup. I'd need to think about this more but it's dev-only.

Test plan

  • Added new test for nesting RSC renderers (ReactNoopFlight + ReactMarkup) which produced the "Currently React only supports one RSC renderer at a time." error initially.

eps1lon avatar Aug 17 '24 15:08 eps1lon

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 4, 2024 2:34pm

vercel[bot] avatar Aug 17 '24 15:08 vercel[bot]

Comparing: d1afcb43fd506297109c32ff462f6f659f9110ae...da393281cf3bed5fb0cf1b58b06a4295076173e8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB +0.05% 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 501.40 kB 501.18 kB = 89.99 kB 89.94 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 508.52 kB 508.30 kB = 91.16 kB 91.11 kB
facebook-www/ReactDOM-prod.classic.js = 596.16 kB 595.93 kB = 105.69 kB 105.63 kB
facebook-www/ReactDOM-prod.modern.js = 572.44 kB 572.22 kB = 101.88 kB 101.82 kB
oss-experimental/react/cjs/react.react-server.production.js +2.19% 18.66 kB 19.07 kB +1.73% 4.97 kB 5.05 kB
oss-experimental/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB
oss-stable-rc/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB
oss-stable-semver/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB
oss-stable/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react/cjs/react.react-server.production.js +2.19% 18.66 kB 19.07 kB +1.73% 4.97 kB 5.05 kB
oss-stable-rc/react/cjs/react.react-server.production.js +1.47% 13.28 kB 13.47 kB +1.18% 3.66 kB 3.70 kB
oss-stable-semver/react/cjs/react.react-server.production.js +1.47% 13.28 kB 13.47 kB +1.18% 3.66 kB 3.70 kB
oss-stable/react/cjs/react.react-server.production.js +1.47% 13.30 kB 13.49 kB +1.22% 3.68 kB 3.72 kB
oss-experimental/react/cjs/react.react-server.development.js +1.24% 35.85 kB 36.30 kB +1.06% 8.48 kB 8.57 kB
oss-experimental/react/cjs/react.production.js +1.19% 17.97 kB 18.18 kB +1.35% 4.67 kB 4.73 kB
facebook-react-native/react/cjs/React-prod.js +1.14% 18.69 kB 18.91 kB +1.30% 4.86 kB 4.92 kB
facebook-react-native/react/cjs/React-profiling.js +1.12% 19.13 kB 19.34 kB +1.28% 4.94 kB 5.00 kB
facebook-www/React-prod.modern.js +0.96% 22.32 kB 22.54 kB +1.03% 5.82 kB 5.88 kB
facebook-www/React-prod.classic.js +0.96% 22.33 kB 22.54 kB +1.05% 5.82 kB 5.88 kB
facebook-www/React-profiling.modern.js +0.94% 22.76 kB 22.97 kB +1.02% 5.90 kB 5.96 kB
facebook-www/React-profiling.classic.js +0.94% 22.76 kB 22.97 kB +1.02% 5.90 kB 5.96 kB
oss-stable-rc/react/cjs/react.react-server.development.js +0.55% 40.17 kB 40.39 kB +0.47% 9.20 kB 9.24 kB
oss-stable-semver/react/cjs/react.react-server.development.js +0.55% 40.17 kB 40.39 kB +0.47% 9.20 kB 9.24 kB
oss-stable/react/cjs/react.react-server.development.js +0.55% 40.19 kB 40.41 kB +0.49% 9.22 kB 9.26 kB
oss-experimental/react/cjs/react.development.js +0.49% 45.32 kB 45.54 kB +0.60% 10.34 kB 10.40 kB
facebook-react-native/react/cjs/React-dev.js +0.35% 62.58 kB 62.80 kB +0.43% 13.76 kB 13.82 kB
facebook-www/React-dev.modern.js +0.30% 73.36 kB 73.58 kB +0.37% 16.09 kB 16.15 kB
facebook-www/React-dev.classic.js +0.30% 74.22 kB 74.44 kB +0.37% 16.22 kB 16.28 kB
oss-experimental/react-server/cjs/react-server-flight.production.js = 64.64 kB 64.49 kB = 12.54 kB 12.45 kB
oss-stable-rc/react-server/cjs/react-server-flight.production.js = 58.41 kB 58.25 kB = 11.59 kB 11.54 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.js = 58.41 kB 58.25 kB = 11.59 kB 11.54 kB
oss-stable/react-server/cjs/react-server-flight.production.js = 58.41 kB 58.25 kB = 11.59 kB 11.54 kB
oss-experimental/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB
oss-stable-rc/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB
oss-stable-semver/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB
oss-stable/react-suspense-test-utils/cjs/react-suspense-test-utils.js = 1.22 kB 1.06 kB = 0.60 kB 0.54 kB

Generated by :no_entry_sign: dangerJS against 35507c5e993e0ab0d79c2f9c8b78bab28eb7a4ab

react-sizebot avatar Aug 17 '24 15:08 react-sizebot

We should chain the owner too. If there is no owner on the inner one, it should defer to the outer (previous) dispatcher to see if it has one.

sebmarkbage avatar Aug 27 '24 17:08 sebmarkbage

We should chain the owner too. If there is no owner on the inner one, it should defer to the outer (previous) dispatcher to see if it has one.

From what I can tell they're not just broken at the dispatcher level but also with regards to getCurrentStack. I can take a look at these in a follow-up since they're dev-only and experimentation is otherwise blocked.

eps1lon avatar Aug 27 '24 20:08 eps1lon

I can take a look at these in a follow-up since they're dev-only and experimentation is otherwise blocked.

Just keep in mind that this blocks the RSC DevTools stuff and enableOwnerStacks if they end up getting installed in the wrong order.

sebmarkbage avatar Aug 27 '24 20:08 sebmarkbage

Just keep in mind that this blocks the RSC DevTools stuff and enableOwnerStacks if they end up getting installed in the wrong order.

Yeah, I'll get it right in this one.

eps1lon avatar Aug 27 '24 21:08 eps1lon