Fix undefined chart node when switching commits in profiler

This commit is contained in:
Lucas Cordeiro
2019-05-17 09:35:10 -03:00
parent f10a6b379c
commit 1e025edb9a
@@ -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]);