From 1e025edb9a91fcd7facfb3c58fd9ba808515e50a Mon Sep 17 00:00:00 2001 From: Lucas Cordeiro Date: Fri, 17 May 2019 09:35:10 -0300 Subject: [PATCH] Fix undefined chart node when switching commits in profiler --- src/devtools/views/Profiler/CommitFlamegraph.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/devtools/views/Profiler/CommitFlamegraph.js b/src/devtools/views/Profiler/CommitFlamegraph.js index 9827224152..091fd96b61 100644 --- a/src/devtools/views/Profiler/CommitFlamegraph.js +++ b/src/devtools/views/Profiler/CommitFlamegraph.js @@ -123,9 +123,13 @@ function CommitFlamegraph({ const selectedChartNode = useMemo(() => { let chartNode = null; if (selectedFiberID !== null) { - chartNode = ((chartData.rows[selectedChartNodeIndex].find( + const foundChartNode = chartData.rows[selectedChartNodeIndex].find( chartNode => chartNode.id === selectedFiberID - ): any): ChartNode); + ); + + if (foundChartNode !== undefined) { + chartNode = foundChartNode; + } } return chartNode; }, [chartData, selectedFiberID, selectedChartNodeIndex]);