-
Notifications
You must be signed in to change notification settings - Fork 50.2k
[DevTools] Unify by using ReactFunctionLocation type instead of Source #33955
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
Conversation
This collects locations from parent Component Stacks. These are conceptually ReactFunctionLocations (top of the function) as opposed to ReactCallSite that are usually part of stacks like owner stacks.
Ideally we'd parse the function name out of the sourceContent of the original position.
| export type ViewElementSource = ( | ||
| source: Source, | ||
| symbolicatedSource: Source | null, | ||
| source: ReactFunctionLocation, |
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 don't know if there are any consumers of this in fusebox that needs to be updated. If so, it's probably just the same as the standalone.
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 package is private and the only user is React Native DevTools.
This should be fine, I will update this next time I upgrade React DevTools for React Native DevTools.
| source: source && source.sourceURL ? source : null, | ||
| // Previous backend implementations (<= 6.1.5) have a different interface for Source. | ||
| // This gates the source features for only compatible backends: >= 6.1.6 | ||
| source: Array.isArray(source) ? source : null, |
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.
Not sure where this is needed but following the same pattern.
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 needed in case there is a version mismatch between Backend and Frontend. Not applicable to browser extensions, only to standalone / inline / fusebox versions, where only Frontend is shipped, and Backend is used from react-devtools-core npm package.
For example, if Frontend would have your change, but Backend didn't, there would be type mismatch and Frontend would potentially treat plain object as an array.
facebook#33955) In RSC and other stacks now we use a lot of `ReactFunctionLocation` type to represent the location of a function. I.e. the location of the beginning of the function (the enclosing line/col) that is represented by the "Source" of the function. This is also what the parent Component Stacks represents. As opposed to `ReactCallSite` which is what normal stack traces and owner stacks represent. I.e. the line/column number of the callsite into the next function. We can start sharing more code by using the `ReactFunctionLocation` type to represent the component source location and it also helps clarify which ones are function locations and which ones are callsites as we start adding more stack traces (e.g. for async debug info and owner stack traces). DiffTrain build for [7513996](facebook@7513996)
facebook#33955) In RSC and other stacks now we use a lot of `ReactFunctionLocation` type to represent the location of a function. I.e. the location of the beginning of the function (the enclosing line/col) that is represented by the "Source" of the function. This is also what the parent Component Stacks represents. As opposed to `ReactCallSite` which is what normal stack traces and owner stacks represent. I.e. the line/column number of the callsite into the next function. We can start sharing more code by using the `ReactFunctionLocation` type to represent the component source location and it also helps clarify which ones are function locations and which ones are callsites as we start adding more stack traces (e.g. for async debug info and owner stack traces). DiffTrain build for [7513996](facebook@7513996)
In RSC and other stacks now we use a lot of
ReactFunctionLocationtype to represent the location of a function. I.e. the location of the beginning of the function (the enclosing line/col) that is represented by the "Source" of the function. This is also what the parent Component Stacks represents.As opposed to
ReactCallSitewhich is what normal stack traces and owner stacks represent. I.e. the line/column number of the callsite into the next function.We can start sharing more code by using the
ReactFunctionLocationtype to represent the component source location and it also helps clarify which ones are function locations and which ones are callsites as we start adding more stack traces (e.g. for async debug info and owner stack traces).