[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.
Sebastian Markbåge committed
Jul 6, 2025 at 17:05 UTC
9a645e1d1027962047d2b6b26af12357203784c9
1 file changed
+5
-5
packages/react-server/src/ReactFlightServer.js
+5
-5
@@ -204,17 +204,17 @@ function findCalledFunctionNameFromStackTrace(
204
const callsite = stack[i];
205
const functionName = callsite[0];
206
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)) {
212
if (bestMatch === '') {
213
// If we had no good stack frames for internal calls, just use the last
214
// first party function name.
215
return functionName;
216
}
217
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.
218
} else {
219
bestMatch = functionName;
220
}