-
Notifications
You must be signed in to change notification settings - Fork 48.3k
[Fizz] Implement debugInfo #30174
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
[Fizz] Implement debugInfo #30174
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,17 +244,19 @@ if (!__EXPERIMENTAL__) { | |
expect(caughtErrors.length).toBe(1); | ||
expect(caughtErrors[0].error).toBe(thrownError); | ||
expect(normalizeCodeLocInfo(caughtErrors[0].parentStack)).toBe( | ||
// TODO: Because Fizz doesn't yet implement debugInfo for parent stacks | ||
// it doesn't have the Server Components in the parent stacks. | ||
'\n in Lazy (at **)' + | ||
'\n in div (at **)' + | ||
'\n in div (at **)', | ||
__DEV__ | ||
? '\n in Baz (at **)' + | ||
'\n in div (at **)' + | ||
'\n in Bar (at **)' + | ||
'\n in Foo (at **)' + | ||
'\n in div (at **)' | ||
: '\n in Lazy (at **)' + | ||
'\n in div (at **)' + | ||
'\n in div (at **)', | ||
); | ||
expect(normalizeCodeLocInfo(caughtErrors[0].ownerStack)).toBe( | ||
__DEV__ && gate(flags => flags.enableOwnerStacks) | ||
? // TODO: Because Fizz doesn't yet implement debugInfo for parent stacks | ||
// it doesn't have the Server Components in the parent stacks. | ||
'\n in Lazy (at **)' | ||
? '\n in Bar (at **)' + '\n in Foo (at **)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that the actual paths here point to fake evals which needs to be source mapped to make sense since this is the "client" stacks showing. An alternative would be to snapshot the stacks on the "server" and then show it here. However, the server likely is compiled and needs to be source mapped anyway so might not matter much. |
||
: null, | ||
); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,11 +185,11 @@ export function getOwnerStackByFiberInDev( | |
// another code path anyway. I.e. this is likely NOT a V8 based browser. | ||
// This will cause some of the stack to have different formatting. | ||
// TODO: Normalize server component stacks to the client formatting. | ||
if (owner.stack !== '') { | ||
info += '\n' + owner.stack; | ||
const ownerStack: string = owner.stack; | ||
owner = owner.owner; | ||
if (owner && ownerStack !== '') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For client components, we only included the stack if there was an owner (to eliminate some of the initial bootstrapping stacks) but we didn't do the same for server components. This fixes that in Fiber and Fizz. |
||
info += '\n' + ownerStack; | ||
} | ||
const componentInfo: ReactComponentInfo = (owner: any); | ||
owner = componentInfo.owner; | ||
} else { | ||
break; | ||
} | ||
|
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.
These don't have line numbers because they're server components and we don't give those line numbers for parent stacks.