Skip to content

Commit

Permalink
Reverse engineer original stack frames when virtual frames are re-se…
Browse files Browse the repository at this point in the history
…rialized (facebook#30416)

Stacked on facebook#30410.

If we've parsed another RSC stream on the server from a different RSC
server, while using `findSourceMapURL`, the Flight Client ends up adding
a `rsc://React/` prefix and a numeric suffix to the URL. It's a virtual
file that represents the virtual eval:ed frame in that environment.

If we then see that same stack again, we'd serialize a virtual frame to
another virtual. Meaning `findSourceMapURL` on the client would see the
virtual frame of the intermediate server and it would have to strip it
to figure out what source map to use.

This PR strips it in the Server if we see a virtual frame. At each new
client it always refers to the original stack.

We don't have to do this. We could leave it to each `findSourceMapURL`
implementation and `captureOwnerStack` parser to recursively strip each
layer. It could maybe be useful to have the environment name in the
virtual frame to know which server to look for the source map in.
  • Loading branch information
felixshiftellecon committed Jul 24, 2024
1 parent f83615a commit 58ad21b
Showing 1 changed file with 271 additions and 255 deletions.
Loading

0 comments on commit 58ad21b

Please sign in to comment.