Repository navigation
[Flight] Strip the full <anonymous>. type name prefix from I/O names - #37856
Merged
Merged
Conversation
## Summary `serializeIONode` picks the name of an I/O entry from the name of the first first-party function in the stack. That name can include the type name that the function was called on. Since that context is usually not useful, the name is reduced to just the function, e.g. `Window.fetch` becomes `fetch`. The `<anonymous>.` case copied the slice length straight from the `Window.` case above it, but that prefix is 12 characters long, not 7. So instead of stripping the prefix it damaged the name. I/O started from a method of an object that reports itself as `<anonymous>` through `Symbol.toStringTag` is reported as `ous>.getData` instead of `getData`. This was introduced in react#33392. ## How did you test this change? - Added a regression test that starts I/O from a method of an object whose `Symbol.toStringTag` is `<anonymous>`, which makes V8 name the stack frame `<anonymous>.getData`. It reports `ous>.getData` before the fix. - `yarn test ReactFlightAsyncDebugInfo --runInBand` (21 passed) - `yarn test ReactFlight --runInBand` (437 passed, 3 pre-existing ReactFlightDOMEdge SharedArrayBuffer failures that also fail on main) - `yarn linc` - `node scripts/prettier/index.js check-changed`
|
Comparing: 99c106c...6dbf84b Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) Generated by sizebot against 6dbf84b |
eps1lon
reviewed
Oct 15, 2026
eps1lon
pushed a commit
to vercel/next.js
that referenced
this pull request
Oct 20, 2026
[diff react/react@99c106c4...ba39b32a](react/react@99c106c...ba39b32) <details> <summary>React upstream changes</summary> - react/react#37853 - react/react#37856 - react/react#37855 </details> --------- Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
serializeIONodepicks the name of an I/O entry from the name of the first first-party function in the stack. That name can include the type name that the function was called on. Since that context is usually not useful, the name is reduced to just the function, e.g.Window.fetchbecomesfetch.The
<anonymous>.case copied the slice length straight from theWindow.case above it, but that prefix is 12 characters long, not 7. So instead of stripping the prefix it damaged the name:This was introduced in #33392 and is the only place in the repo that strips this prefix.
Reproducing
V8 derives the type name of a method call from the receiver, and
Symbol.toStringTagis honored there. An object that reports itself as<anonymous>therefore produces stack frames named<anonymous>.getData:CallSite.prototype.toString()for that frame is<anonymous>.getData (file:1:1), so this shape is produced by both the structured stack parser and the string stack parser.Starting I/O from that method, the recorded stack frame is correctly named
<anonymous>.getData, but the name reported for the I/O itself — which is what DevTools shows — is mangled:{ "awaited": { "name": "ous>.getData", "stack": [["<anonymous>.getData", ".../ReactFlightAsyncDebugInfo-test.js", 563, 16, 562, 16]] } }After the fix the reported name is
getData.How did you test this change?
Added a regression test to
ReactFlightAsyncDebugInfo-test.jswhich starts I/O from a method of an object whoseSymbol.toStringTagis<anonymous>. It fails before the fix withExpected: "getData"/Received: "ous>.getData", and the test also asserts the recorded stack frame is still<anonymous>.getDataso it fails loudly if V8 ever stops producing that shape. The test is appended at the end of the suite so that the line numbers referenced by the existing inline snapshots do not shift.yarn test ReactFlightAsyncDebugInfo --runInBand— 21 passedyarn test ReactFlight --runInBand— 437 passed; the 3ReactFlightDOMEdgeSharedArrayBufferfailures are pre-existing onmain(verified by stashing the fix and running the same suite)yarn lincnode scripts/prettier/index.js check-changed