Skip to content

Commit 350017f

Browse files
(updated) traverse algo with rounding and proper duplicate component naming
1 parent d78a558 commit 350017f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/app/components/PerformanceVisx.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ const traverse = (snapshot, perfSnapshot) => {
5959
if (!snapshot.children[0]) return
6060
for (let i = 0; i < snapshot.children.length; i++){
6161
if (snapshot.children[i].componentData.actualDuration){
62-
perfSnapshot[snapshot.children[i].name+i] = snapshot.children[i].componentData.actualDuration
62+
const renderTime = Number(Number.parseFloat(snapshot.children[i].componentData.actualDuration).toPrecision(5))
63+
perfSnapshot[snapshot.children[i].name+-[i+1]] = renderTime
6364
}
6465
traverse(snapshot.children[i], perfSnapshot)
6566
}

0 commit comments

Comments
 (0)