Skip to content

[DevTools] Handle bundles (multi sources) when parsing hook names #21794

@bvaughn

Description

@bvaughn

DevTools hooks name parsing code currently assumes a single "source" for the source map:
https://github.com/facebook/react/blob/ed6c091fe961a3b95e956ebcefe8f152177b1fb7/packages/react-devtools-extensions/src/parseHookNames.js#L428-L434

But as pointed out by comment #21641 (comment):

If the compiled code is a bundle, it can consist of multiple modules - what guarantees that sources[0] is the correct module for the hook we'll be looking up? The originalPositionFor call in findHookNames above returns a source property which we currently ignore; I think the correct thing to do is to lazily parse/cache the source at that point rather than make this assumption here.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions