From 01019aa7b4c07583e781fa2628aa069bfd49f845 Mon Sep 17 00:00:00 2001 From: Hristo Kanchev Date: Thu, 29 Aug 2019 10:22:38 +0200 Subject: [PATCH 1/3] Added anchor dom element in order to successfully download profiling data. --- .../devtools/views/Profiler/ProfilingImportExportButtons.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilingImportExportButtons.js b/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilingImportExportButtons.js index 376afcf45e883..8f6b40199ea2e 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilingImportExportButtons.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilingImportExportButtons.js @@ -29,6 +29,7 @@ export default function ProfilingImportExportButtons() { const {profilerStore} = store; const inputRef = useRef(null); + const downloadRef = useRef(null); const {dispatch: modalDialogDispatch} = useContext(ModalDialogContext); @@ -38,7 +39,7 @@ export default function ProfilingImportExportButtons() { return; } - if (profilingData !== null) { + if (profilingData !== null && downloadRef.current !== null) { const profilingDataExport = prepareProfilingDataExport(profilingData); const date = new Date(); const dateString = date @@ -54,6 +55,7 @@ export default function ProfilingImportExportButtons() { }) .replace(/:/g, '-'); downloadFile( + downloadRef.current, `profiling-data.${dateString}.${timeString}.json`, JSON.stringify(profilingDataExport, null, 2), ); @@ -114,6 +116,7 @@ export default function ProfilingImportExportButtons() { onChange={handleFiles} tabIndex={-1} /> +