Skip to content

[pull] main from facebook:main #191

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

Merged
merged 2 commits into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -3154,15 +3154,15 @@ function createFakeFunction<T>(
}

if (sourceMap) {
// We use the prefix rsc://React/ to separate these from other files listed in
// We use the prefix about://React/ to separate these from other files listed in
// the Chrome DevTools. We need a "host name" and not just a protocol because
// otherwise the group name becomes the root folder. Ideally we don't want to
// show these at all but there's two reasons to assign a fake URL.
// 1) A printed stack trace string needs a unique URL to be able to source map it.
// 2) If source maps are disabled or fails, you should at least be able to tell
// which file it was.
code +=
'\n//# sourceURL=rsc://React/' +
'\n//# sourceURL=about://React/' +
encodeURIComponent(environmentName) +
'/' +
encodeURI(filename) +
Expand Down
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactFlightReplyClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,15 +1095,15 @@ function createFakeServerFunction<A: Iterable<any>, T>(
}

if (sourceMap) {
// We use the prefix rsc://React/ to separate these from other files listed in
// We use the prefix about://React/ to separate these from other files listed in
// the Chrome DevTools. We need a "host name" and not just a protocol because
// otherwise the group name becomes the root folder. Ideally we don't want to
// show these at all but there's two reasons to assign a fake URL.
// 1) A printed stack trace string needs a unique URL to be able to source map it.
// 2) If source maps are disabled or fails, you should at least be able to tell
// which file it was.
code +=
'\n//# sourceURL=rsc://React/' +
'\n//# sourceURL=about://React/' +
encodeURIComponent(environmentName) +
'/' +
encodeURI(filename) +
Expand Down
6 changes: 3 additions & 3 deletions packages/react-client/src/__tests__/ReactFlight-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ describe('ReactFlight', () => {
' at async file:///testing.js:42:3',
// third-party RSC frame
// Ideally this would be a real frame produced by React not a mocked one.
' at ThirdParty (rsc://React/ThirdParty/file:///code/%5Broot%2520of%2520the%2520server%5D.js?42:1:1)',
' at ThirdParty (about://React/ThirdParty/file:///code/%5Broot%2520of%2520the%2520server%5D.js?42:1:1)',
// We'll later filter this out based on line/column in `filterStackFrame`.
' at ThirdPartyModule (file:///file-with-index-source-map.js:52656:16374)',
// host component in parent stack
Expand Down Expand Up @@ -3073,7 +3073,7 @@ describe('ReactFlight', () => {
ReactNoopFlightClient.read(transport, {
findSourceMapURL(url) {
// By giving a source map url we're saying that we can't use the original
// file as the sourceURL, which gives stack traces a rsc://React/ prefix.
// file as the sourceURL, which gives stack traces a about://React/ prefix.
return 'source-map://' + url;
},
}),
Expand Down Expand Up @@ -3147,7 +3147,7 @@ describe('ReactFlight', () => {
expectedErrorStack={expectedErrorStack}>
{ReactNoopFlightClient.read(transport, {
findSourceMapURL(url, environmentName) {
if (url.startsWith('rsc://React/')) {
if (url.startsWith('about://React/')) {
// We don't expect to see any React prefixed URLs here.
sawReactPrefix = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function getOwnerStackByFiberInDev(
if (typeof owner.tag === 'number') {
const fiber: Fiber = (owner: any);
owner = fiber._debugOwner;
let debugStack = fiber._debugStack;
let debugStack: void | null | string | Error = fiber._debugStack;
// If we don't actually print the stack if there is no owner of this JSX element.
// In a real app it's typically not useful since the root app is always controlled
// by the framework. These also tend to have noisy stacks because they're not rooted
Expand Down
11 changes: 4 additions & 7 deletions packages/react-reconciler/src/ReactFiberComponentStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,17 @@ export function getOwnerStackByFiberInDev(workInProgress: Fiber): string {
if (typeof owner.tag === 'number') {
const fiber: Fiber = (owner: any);
owner = fiber._debugOwner;
let debugStack = fiber._debugStack;
const debugStack = fiber._debugStack;
// If we don't actually print the stack if there is no owner of this JSX element.
// In a real app it's typically not useful since the root app is always controlled
// by the framework. These also tend to have noisy stacks because they're not rooted
// in a React render but in some imperative bootstrapping code. It could be useful
// if the element was created in module scope. E.g. hoisted. We could add a a single
// stack frame for context for example but it doesn't say much if that's a wrapper.
if (owner && debugStack) {
if (typeof debugStack !== 'string') {
// Stash the formatted stack so that we can avoid redoing the filtering.
fiber._debugStack = debugStack = formatOwnerStack(debugStack);
}
if (debugStack !== '') {
info += '\n' + debugStack;
const formattedStack = formatOwnerStack(debugStack);
if (formattedStack !== '') {
info += '\n' + formattedStack;
}
}
} else if (owner.debugStack != null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactInternalTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export type Fiber = {

_debugInfo?: ReactDebugInfo | null,
_debugOwner?: ReactComponentInfo | Fiber | null,
_debugStack?: string | Error | null,
_debugStack?: Error | null,
_debugTask?: ConsoleTask | null,
_debugNeedsRemount?: boolean,

Expand Down
4 changes: 2 additions & 2 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ function defaultFilterStackFrame(
}

function devirtualizeURL(url: string): string {
if (url.startsWith('rsc://React/')) {
if (url.startsWith('about://React/')) {
// This callsite is a virtual fake callsite that came from another Flight client.
// We need to reverse it back into the original ___location by stripping its prefix
// and suffix. We don't need the environment name because it's available on the
// parent object that will contain the stack.
const envIdx = url.indexOf('/', 'rsc://React/'.length);
const envIdx = url.indexOf('/', 'about://React/'.length);
const suffixIdx = url.lastIndexOf('?');
if (envIdx > -1 && suffixIdx > -1) {
return decodeURI(url.slice(envIdx + 1, suffixIdx));
Expand Down
Loading