Skip to content

Commit

Permalink
[Fiber] Track debugInfo on module state instead of stack (#29807)
Browse files Browse the repository at this point in the history
Stacked on #29804.

Transferring of debugInfo was added in #28286. It represents the parent
stack between the current Fiber and into the next Fiber we're about to
create. I.e. Server Components in between. ~I don't love passing
DEV-only fields as arguments anyway since I don't trust closure to
remove unused arguments that way.~ EDIT: Actually it seems like closure
handled that just fine before which is why this is no change in prod.

Instead, I track it on the module scope. Notably with DON'T use
try/finally because if something throws we want to observe what it was
at the time we threw. Like the pattern we use many other places.

Now we can use this when we create the Throw Fiber to associate the
Server Components that were part of the parent stack before this error
threw. There by giving us the correct parent stacks at the location that
threw.
  • Loading branch information
sebmarkbage authored Jun 11, 2024
1 parent 270229f commit 2c959f1
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 124 deletions.
6 changes: 4 additions & 2 deletions packages/react-client/src/__tests__/ReactFlight-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,10 @@ describe('ReactFlight', () => {
}

const expectedStack = __DEV__
? // TODO: This should include Throw but it doesn't have a Fiber.
'\n in div' + '\n in ErrorBoundary (at **)' + '\n in App'
? '\n in Throw' +
'\n in div' +
'\n in ErrorBoundary (at **)' +
'\n in App'
: '\n in div' + '\n in ErrorBoundary (at **)';

function App() {
Expand Down
Loading

0 comments on commit 2c959f1

Please sign in to comment.