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]);