File tree 2 files changed +12
-0
lines changed
packages/react-devtools-extensions/src 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -133,10 +133,15 @@ function compile(fileName) {
133
133
const encodedHookMap = generateEncodedHookMap ( parsed ) ;
134
134
const fbSourcesExtendedSourceMap = {
135
135
...sourceMap ,
136
+ // When using the x_fb_sources extension field, the first item
137
+ // for a given source is reserved for the Function Map, and the
138
+ // Hook Map is added as the second item.
136
139
x_fb_sources : [ [ null , encodedHookMap ] ] ,
137
140
} ;
138
141
const reactSourcesExtendedSourceMap = {
139
142
...sourceMap ,
143
+ // When using the x_react_sources extension field, the first item
144
+ // for a given source is reserved for the Hook Map.
140
145
x_react_sources : [ [ encodedHookMap ] ] ,
141
146
} ;
142
147
Original file line number Diff line number Diff line change @@ -667,8 +667,15 @@ function extractHookMapFromSourceMap(
667
667
) : HookMap | null {
668
668
let hookMap ;
669
669
if ( sourcemap . hasOwnProperty ( REACT_SOURCES_EXTENSION_KEY ) ) {
670
+ // When using the x_react_sources extension field, the first item
671
+ // for a given source is reserved for the Hook Map, which is why
672
+ // we look up the index at position 0.
670
673
hookMap = sourcemap [ REACT_SOURCES_EXTENSION_KEY ] [ sourceIndex ] [ 0 ] ;
671
674
} else if ( sourcemap . hasOwnProperty ( FB_SOURCES_EXTENSION_KEY ) ) {
675
+ // When using the x_fb_sources extension field, the first item
676
+ // for a given source is reserved for the Function Map, and the
677
+ // Hook Map is added as the second item, which is why we look up
678
+ // the index at position 1.
672
679
hookMap = sourcemap [ FB_SOURCES_EXTENSION_KEY ] [ sourceIndex ] [ 1 ] ;
673
680
}
674
681
if ( hookMap != null ) {
You can’t perform that action at this time.
0 commit comments