@samitouri / QOS-React-2 / commits / 1e025edb9a

Fix undefined chart node when switching commits in profiler

Lucas Cordeiro committed May 17, 2019 at 09:35 UTC 1e025edb9a91fcd7facfb3c58fd9ba808515e50a
1 file changed +6 -2
src/devtools/views/Profiler/CommitFlamegraph.js
+6 -2
@@ -123,9 +123,13 @@ function CommitFlamegraph({
123 const selectedChartNode = useMemo(() => {
124 let chartNode = null;
125 if (selectedFiberID !== null) {
126 - chartNode = ((chartData.rows[selectedChartNodeIndex].find(
126 + const foundChartNode = chartData.rows[selectedChartNodeIndex].find(
127 chartNode => chartNode.id === selectedFiberID
128 - ): any): ChartNode);
128 + );
129 +
130 + if (foundChartNode !== undefined) {
131 + chartNode = foundChartNode;
132 + }
133 }
134 return chartNode;
135 }, [chartData, selectedFiberID, selectedChartNodeIndex]);