Skip to content

Commit 9a645e1

Browse files
authored
[Flight] Ignore "new Promise" and async_hooks even if they're not ignore listed (#33714)
These are part of the internals of Promises and async functions even if anonymous functions are otherwise not ignore listed.
1 parent 2d7f0c4 commit 9a645e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,17 @@ function findCalledFunctionNameFromStackTrace(
204204
const callsite = stack[i];
205205
const functionName = callsite[0];
206206
const url = devirtualizeURL(callsite[1]);
207-
if (filterStackFrame(url, functionName)) {
207+
if (functionName === 'new Promise') {
208+
// Ignore Promise constructors.
209+
} else if (url === 'node:internal/async_hooks') {
210+
// Ignore the stack frames from the async hooks themselves.
211+
} else if (filterStackFrame(url, functionName)) {
208212
if (bestMatch === '') {
209213
// If we had no good stack frames for internal calls, just use the last
210214
// first party function name.
211215
return functionName;
212216
}
213217
return bestMatch;
214-
} else if (functionName === 'new Promise') {
215-
// Ignore Promise constructors.
216-
} else if (url === 'node:internal/async_hooks') {
217-
// Ignore the stack frames from the async hooks themselves.
218218
} else {
219219
bestMatch = functionName;
220220
}

0 commit comments

Comments
 (0)