[DevTools] Use source maps to infer name asynchronously #34212
Merged
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.
Stacked on #34210.
For inferred name of Promises, like an anonymous Promise passed to
use()we currently take the function name of the first stack frame. #34162This is usually good enough but if the Hook is in third party code then it can be a deep internal hook that you don't know anything about. This tries to skip ignore listed hooks and take the last ignore listed hook that was ignore listed. So that we get the name of the callsite into third party which is likely the name of the public API.
This would now briefly show the name
useInternalHookand then switch touseHookafter source mapping.This also tries to take the function name from the source mapped name but currently this is always empty since our source mapping doesn't extract the function name from source. So it always fallback to the generated source's function name.