-
Notifications
You must be signed in to change notification settings - Fork 49.5k
[DevTools] Source Map Stack Traces such in await locations #34094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DevTools] Source Map Stack Traces such in await locations #34094
Conversation
|
||
const symbolicatedCallSite: null | ReactFunctionLocation = | ||
fetchFileWithCaching !== null | ||
? use( |
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.
Do we give up on supporting older React versions for react-devtools-inline
?
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 do you mean older React versions? It's all versions if the react-devtools-inline
host isn't providing a way to fetch the files?
Older versions won't get any stacks anyway since it won't exist in the data.
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 meant using use
which doesn't exist in all versions of React. The frontend is currently written in a way that makes it compatible with older versions of React. So if you implement fetchFileWithCaching
but are using React 17 for some reason for the frontend, you'll get error if you're inspecting newer React.
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.
We already use it elsewhere so I guess we don't support that.
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 didn't see those. Feels odd that we check in some places but not all e.g.
if (typeof React.use === 'function') { |
78291b3
to
e98cc3b
Compare
columnNumber, // 1-based | ||
}); | ||
|
||
const column = columnZeroBased + 1; |
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 fixes an existing issue where we were returning a zero based column when the data structure expects a one based column.
… different owner (#34101) Stacked on #34094. This shows the I/O stack if available. If it's not available or if it has a different owner (like if it was passed in) then we show the `"awaited at:"` stack below it so you can see where it started and where it was awaited. If it's the same owner this tends to be unnecessary noise. We could maybe be smarter if the stacks are very different then you might want to show both even with the same owner. <img width="517" height="478" alt="Screenshot 2025-08-04 at 11 57 28 AM" src="https://github.com/user-attachments/assets/2dbfbed4-4671-4a5f-8e6e-ebec6fe8a1b7" /> Additionally, this adds an inferred await if there's no owner and no stack for the await. The inferred await of a function/class component is just the owner. No stack. Because the stack trace would be the return value. This will also be the case if you use throw-a-Promise. The inferred await in the child position of a built-in is the JSX location of that await like if you pass a promise to a child. This inference already happens when you pass a Promise from RSC so in this case it already has an await - so this is mainly for client promises.
…d in ReactCallSite and ReactFunctionLocation
7d23f6f
to
dded82b
Compare
The main one landed as part of #34101. The landed part here is just the fix to columns. |
…34094) Stacked on facebook#34093. Instead of using the original `ReactStackTrace` that has the call sites on the server, this parses the `Error` object which has the virtual call sites on the client. We'll need this technique for things stack traces suspending on the client anyway like `use()`. We can then use these callsites to source map in the front end. We currently don't source map function names but might be useful for this use case as well as getting original component names from prod. One thing this doesn't do yet is that it doesn't ignore list the stack traces on the client using the source map's ignore list setting. It's not super important since we expect to have already ignore listed on the server but this will become important for client stack traces like `use()`. DiffTrain build for [b080063](facebook@b080063)
…34094) Stacked on facebook#34093. Instead of using the original `ReactStackTrace` that has the call sites on the server, this parses the `Error` object which has the virtual call sites on the client. We'll need this technique for things stack traces suspending on the client anyway like `use()`. We can then use these callsites to source map in the front end. We currently don't source map function names but might be useful for this use case as well as getting original component names from prod. One thing this doesn't do yet is that it doesn't ignore list the stack traces on the client using the source map's ignore list setting. It's not super important since we expect to have already ignore listed on the server but this will become important for client stack traces like `use()`. DiffTrain build for [b080063](facebook@b080063)
Stacked on #34093.
Instead of using the original
ReactStackTrace
that has the call sites on the server, this parses theError
object which has the virtual call sites on the client. We'll need this technique for things stack traces suspending on the client anyway likeuse()
.We can then use these callsites to source map in the front end.
We currently don't source map function names but might be useful for this use case as well as getting original component names from prod.
One thing this doesn't do yet is that it doesn't ignore list the stack traces on the client using the source map's ignore list setting. It's not super important since we expect to have already ignore listed on the server but this will become important for client stack traces like
use()
.