File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
packages/react-devtools-extensions/src Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -133,10 +133,15 @@ function compile(fileName) {
133133 const encodedHookMap = generateEncodedHookMap ( parsed ) ;
134134 const fbSourcesExtendedSourceMap = {
135135 ...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.
136139 x_fb_sources : [ [ null , encodedHookMap ] ] ,
137140 } ;
138141 const reactSourcesExtendedSourceMap = {
139142 ...sourceMap ,
143+ // When using the x_react_sources extension field, the first item
144+ // for a given source is reserved for the Hook Map.
140145 x_react_sources : [ [ encodedHookMap ] ] ,
141146 } ;
142147
Original file line number Diff line number Diff line change @@ -667,8 +667,15 @@ function extractHookMapFromSourceMap(
667667) : HookMap | null {
668668 let hookMap ;
669669 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.
670673 hookMap = sourcemap [ REACT_SOURCES_EXTENSION_KEY ] [ sourceIndex ] [ 0 ] ;
671674 } 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.
672679 hookMap = sourcemap [ FB_SOURCES_EXTENSION_KEY ] [ sourceIndex ] [ 1 ] ;
673680 }
674681 if ( hookMap != null ) {
You can’t perform that action at this time.
0 commit comments