File tree Expand file tree Collapse file tree 4 files changed +16
-10
lines changed
packages/react-devtools-shared/src/devtools Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -416,6 +416,11 @@ export default class Store extends EventEmitter<{|
416416 }
417417
418418 getElementByID ( id : number ) : Element | null {
419+ if (
420+ this . _profilerStore . _dataFrontend &&
421+ this . _profilerStore . _dataFrontend . imported === true
422+ )
423+ return null ;
419424 const element = this . _idToElement . get ( id ) ;
420425 if ( element == null ) {
421426 console . warn ( `No element found with id "${ id } "` ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import ButtonIcon from '../ButtonIcon';
1616import { StoreContext } from '../context' ;
1717import {
1818 prepareProfilingDataExport ,
19- prepareProfilingDataFrontendFromExport ,
19+ prepareProfilingDataFrontendFromImport ,
2020} from './utils' ;
2121import { downloadFile } from '../utils' ;
2222
@@ -77,11 +77,11 @@ export default function ProfilingImportExportButtons() {
7777 fileReader . addEventListener ( 'load' , ( ) => {
7878 try {
7979 const raw = ( ( fileReader . result : any ) : string ) ;
80- const profilingDataExport = ( ( JSON . parse (
80+ const profilingDataImport = ( ( JSON . parse (
8181 raw ,
8282 ) : any ) : ProfilingDataExport ) ;
83- profilerStore . profilingData = prepareProfilingDataFrontendFromExport (
84- profilingDataExport ,
83+ profilerStore . profilingData = prepareProfilingDataFrontendFromImport (
84+ profilingDataImport ,
8585 ) ;
8686 } catch ( error ) {
8787 modalDialogDispatch ( {
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ export type ProfilingDataForRootFrontend = {|
105105export type ProfilingDataFrontend = { |
106106 // Profiling data per root.
107107 dataForRoots : Map < number , ProfilingDataForRootFrontend> ,
108+ imported : boolean ,
108109| } ;
109110
110111export type CommitDataExport = { |
Original file line number Diff line number Diff line change @@ -99,21 +99,21 @@ export function prepareProfilingDataFrontendFromBackendAndStore(
9999 ) ;
100100 } ) ;
101101
102- return { dataForRoots } ;
102+ return { dataForRoots , imported : false } ;
103103}
104104
105105// Converts a Profiling data export into the format required by the Store.
106- export function prepareProfilingDataFrontendFromExport (
107- profilingDataExport : ProfilingDataExport ,
106+ export function prepareProfilingDataFrontendFromImport (
107+ profilingDataImport : ProfilingDataExport ,
108108) : ProfilingDataFrontend {
109- const { version } = profilingDataExport ;
109+ const { version } = profilingDataImport ;
110110
111111 if ( version !== PROFILER_EXPORT_VERSION ) {
112112 throw Error ( `Unsupported profiler export version "${ version } "` ) ;
113113 }
114114
115115 const dataForRoots : Map < number , ProfilingDataForRootFrontend > = new Map ( ) ;
116- profilingDataExport . dataForRoots . forEach (
116+ profilingDataImport . dataForRoots . forEach (
117117 ( {
118118 commitData,
119119 displayName,
@@ -156,7 +156,7 @@ export function prepareProfilingDataFrontendFromExport(
156156 } ,
157157 ) ;
158158
159- return { dataForRoots } ;
159+ return { dataForRoots , imported : true } ;
160160}
161161
162162// Converts a Store Profiling data into a format that can be safely (JSON) serialized for export.
You can’t perform that action at this time.
0 commit comments