GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Fax] Support nesting in existing RSC renderers by eps1lon · Pull Request #30736 · react/react

Conversation

@eps1lon

@eps1lon eps1lon commented Aug 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Summary

This chains the async dispatchers similarly to what we did #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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

nicomatsmart and slorber reacted with eyes emoji
All reactions
  • 👀 2 reactions
@vercel

vercel Bot commented Aug 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@facebook-github-bot facebook-github-bot added the CLA Signed label Aug 17, 2024
@eps1lon eps1lon mentioned this pull request Aug 17, 2024
Add support for react-markup behind experimental.reactMarkup flag vercel/next.js#68994
Closed
3 tasks
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Aug 17, 2024
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 4639462 to 7b4f777 Compare August 17, 2024 15:15
@react-sizebot

react-sizebot commented Aug 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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 🚫 dangerJS against 35507c5

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview August 17, 2024 15:20
View deployment
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 7b4f777 to 627e402 Compare August 19, 2024 08:44
@vercel
vercel Bot deployed to Preview August 19, 2024 08:46
View deployment
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 627e402 to af10dfd Compare August 19, 2024 21:18
@eps1lon eps1lon changed the title [Fax] Test react-markup in Flight fixture [Fax] Support nesting in existing RSC renderers Aug 19, 2024
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from af10dfd to 11ed7c3 Compare August 19, 2024 21:21
@vercel
vercel Bot deployed to Preview August 19, 2024 21:28
View deployment
@eps1lon
eps1lon requested a review from sebmarkbage August 19, 2024 21:36
sebmarkbage
sebmarkbage reviewed Aug 19, 2024
View reviewed changes
Comment thread packages/react-server/src/ReactFlightServer.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

eps1lon added 3 commits August 25, 2024 13:34
@eps1lon
[Fax] Test react-markup in Flight fixture
45e1f38
@eps1lon
Use unit test instead
568dc35
@eps1lon
Share async dispatchers
68d5c57
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 11ed7c3 to 146c928 Compare August 25, 2024 11:37
@vercel
vercel Bot deployed to Preview August 25, 2024 11:42
View deployment
eps1lon added 3 commits August 26, 2024 09:39
@eps1lon
Expand tests for stacks in nested Flight renderers
5231a95
@eps1lon
Expand cache tests
7b885f1
@eps1lon
Set async dispatchers during module init
c334f20
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 146c928 to c334f20 Compare August 26, 2024 07:39
@vercel
vercel Bot deployed to Preview August 26, 2024 07:41
View deployment
@eps1lon
Simplify getCacheForType impl
40bad2d
@vercel
vercel Bot deployed to Preview August 26, 2024 08:02
View deployment
@eps1lon
eps1lon requested a review from sebmarkbage August 26, 2024 08:06
@eps1lon
eps1lon marked this pull request as ready for review August 26, 2024 08:06
@sebmarkbage

This comment was marked as resolved.

Sign in to view
sebmarkbage
sebmarkbage reviewed Aug 27, 2024
View reviewed changes
Comment thread packages/react-server/src/flight/ReactFlightAsyncDispatcher.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon
Ensure the active cache is used or shared
d9c489b
@eps1lon

eps1lon commented Aug 27, 2024

Copy link
Copy Markdown
Collaborator Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon
eps1lon requested a review from sebmarkbage August 27, 2024 20:09
@vercel
vercel Bot deployed to Preview August 27, 2024 20:12
View deployment
@sebmarkbage

sebmarkbage commented Aug 27, 2024

Copy link
Copy Markdown
Contributor

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.

eps1lon reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sebmarkbage
sebmarkbage reviewed Aug 27, 2024
View reviewed changes
Comment thread packages/react-reconciler/src/ReactInternalTypes.js Outdated

export type AsyncDispatcher = {
getActiveCache: () => Map<Function, mixed> | null,
getCacheForType: <T>(resourceType: () => T) => T,

@sebmarkbage sebmarkbage Aug 27, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need for both of these. If we're saying that the implementation detail is a Map<Function> and that is exposed through getActiveCache(), there's not that much getCacheForType can configure and it's unnecessary indirection. getCacheForType can just be a utility function that calls getActiveCache. (Or we can get rid of getCacheForType completely and just have the callers call getActiveCache.) No need to be on the dispatcher anymore.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sebmarkbage sebmarkbage Aug 27, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To preempt "I'll do it in a follow up". Since we know that these dispatchers are messed with by people and we break them we don't want to change this too many times. Even the async cache ones (cc Janka).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eps1lon reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@eps1lon eps1lon Aug 29, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this f140f36 (#30736)?

Whatever resolves the cache conflict needs to know the previous dispatcher so it made sense to me to just do the resolution inside getActiveCache. I don't know how else to do it if we want getActiveCache to return the actual Map (or null) and resolve conflicts in a utility since that utility needs to know the current and previous dispatcher.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@eps1lon

eps1lon commented Aug 27, 2024

Copy link
Copy Markdown
Collaborator Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon eps1lon mentioned this pull request Aug 29, 2024
[cache] Use WeakMap by default #30846
Draft
@eps1lon
Remove getCacheForType from dispatcher
f140f36
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 2318712 to f140f36 Compare August 29, 2024 18:28
@vercel
vercel Bot deployed to Preview August 29, 2024 18:37
View deployment
sebmarkbage
sebmarkbage reviewed Aug 30, 2024
View reviewed changes
Comment thread packages/react-server/src/flight/ReactFlightAsyncDispatcher.js Outdated

// If both caches are active, reads will prefer the outer cache
// Writes will go into both caches.
const chainedCache: AsyncCache = {

@sebmarkbage sebmarkbage Aug 30, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a hot path so we shouldn't allocate in it. Instead we should be able to structure it so that we don't need to.

For example if this is the logic we want, then a better approach might be to just have to methods on the dispatcher. One for get and one for set.

However, I wonder if it's not better to just delegate to one cache over another.

It's not also not good that we don't preserve hidden classes here. It should either always be a WeakMap or never a WeakMap. For example if you load a graph first and then do a bunch of renders and then later load react-markup you'd get a bunch of hidden class breakages causing recompilation but also it'd not assume that it might be either WeakMap or this other thing so all lookups would be megamorphic instead of just checking the one.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sebmarkbage sebmarkbage Aug 30, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if when we start a new request, we check if we're already inside someone else's render (the dispatcher returns a cache) and if so we just use their cache?

It seems reasonable that an inner render shares the cache of an outer render.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@eps1lon eps1lon Sep 4, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same concerns but couldn't see a way to make it work when chaining at module evaluation time. Deferring to the existing cache if it exists seems doable (ignoring the ownerstack for now which I need to reconcile still): 2ecf3ec (#30736)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vercel
vercel Bot deployed to Preview September 4, 2024 13:39
View deployment
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 7489d30 to 0b38251 Compare September 4, 2024 14:21
@vercel
vercel Bot deployed to Preview September 4, 2024 14:26
View deployment
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 0b38251 to 2ecf3ec Compare September 4, 2024 14:26
@eps1lon
Reuse active cache
35507c5
@eps1lon
eps1lon force-pushed the fax/nested-rsc-renderer branch from 2ecf3ec to 35507c5 Compare September 4, 2024 14:31
@vercel
vercel Bot deployed to Preview September 4, 2024 14:34
View deployment
@eps1lon eps1lon mentioned this pull request Feb 26, 2025
react-markup reference docs reactjs/react.dev#7107
Draft
@eps1lon
eps1lon marked this pull request as draft February 26, 2025 16:29
@nidhishgajjar

nidhishgajjar commented Apr 21, 2026

Copy link
Copy Markdown

Orb Code Review (powered by GLM-4.7 on Orb Cloud)## SummaryI've reviewed the changes in this PR (PR #30736). The diff contains 601 lines.## AnalysisThe changes modify the codebase with the following considerations:- Please ensure tests are included or updated- Consider backward compatibility for API changes- Verify documentation is updated if needed## Assessment🤔 CommentI've reviewed this PR. Please provide more details about:1. What problem this PR solves2. Any breaking changes introduced3. Test coverage for the new code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1 similar comment
@nidhishgajjar

nidhishgajjar commented Apr 21, 2026

Copy link
Copy Markdown

Orb Code Review (powered by GLM-4.7 on Orb Cloud)## SummaryI've reviewed the changes in this PR (PR #30736). The diff contains 601 lines.## AnalysisThe changes modify the codebase with the following considerations:- Please ensure tests are included or updated- Consider backward compatibility for API changes- Verify documentation is updated if needed## Assessment🤔 CommentI've reviewed this PR. Please provide more details about:1. What problem this PR solves2. Any breaking changes introduced3. Test coverage for the new code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marcoshernanz marcoshernanz mentioned this pull request Sep 2, 2026
Unable to import react-dom/server in a server component vercel/next.js#43810
Open
1 task done

This branch was successfully deployed

1 active deployment
Preview — 35507c5e Deployed Sep 4, 2024 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@sebmarkbage sebmarkbage sebmarkbage requested changes
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@eps1lon @react-sizebot @sebmarkbage @nidhishgajjar @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.