Skip to content

Commit 6bc50f7

Browse files
Merge pull request #365 from preactjs/flame-text
2 parents 7fd5489 + 52ab23c commit 6bc50f7

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

src/view/components/profiler/flamegraph/modes/FlamegraphLayout.tsx

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,11 @@ export function FlamegraphLayout({
4545
<Fragment>
4646
{placed.map(pos => {
4747
const node = commit.nodes.get(pos.id)!;
48-
let text: any = "";
49-
if (pos.commitParent || pos.weight === -1) {
50-
text = (
51-
<>
52-
{node.name}
53-
{filterHoc && node.hocs ? (
54-
<HocLabels hocs={node.hocs} nodeId={node.id} canMark={false} />
55-
) : (
56-
""
57-
)}
58-
</>
59-
);
60-
} else {
48+
let appendix = "";
49+
if (!pos.commitParent && pos.weight !== -1) {
6150
const self = formatTime(commit.selfDurations.get(node.id)!);
6251
const total = formatTime(node.endTime - node.startTime);
63-
text = (
64-
<>
65-
{node.name}
66-
{filterHoc && node.hocs ? (
67-
<HocLabels hocs={node.hocs} nodeId={node.id} canMark={false} />
68-
) : (
69-
""
70-
)}{" "}
71-
({self} of {total})
72-
</>
73-
);
52+
appendix = ` (${self} of ${total})`;
7453
}
7554

7655
return (
@@ -85,7 +64,11 @@ export function FlamegraphLayout({
8564
parentId={commit.nodes.get(pos.id)!.parent}
8665
onClick={onSelect}
8766
>
88-
{text}
67+
{node.name}
68+
{filterHoc && node.hocs ? (
69+
<HocLabels hocs={node.hocs} nodeId={node.id} canMark={false} />
70+
) : null}
71+
{appendix}
8972
</FlameNode>
9073
);
9174
})}

0 commit comments

Comments
 (0)