Skip to content

Commit ada00bf

Browse files
committed
Only use/define getFiberName where we actually need it
It might be better still to use a getFiberName where appropriate but this makes the PR less intrusive. We can cherry-pick the commit that introduced getFiberName as a whole later if need be.
1 parent 5e2d2ab commit ada00bf

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

packages/react-reconciler/src/ReactDebugFiberPerf.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ type MeasurementPhase =
3535
| 'getChildContext'
3636
| 'getSnapshotBeforeUpdate';
3737

38-
const getFiberName = (fiber: Fiber): string | null => {
39-
if (fiber.tag === SimpleMemoComponent) {
40-
return getComponentName(fiber.elementType);
41-
}
42-
43-
return getComponentName(fiber.type);
44-
};
45-
4638
// Prefix measurements so that it's possible to filter them.
4739
// Longer prefixes are hard to read in DevTools.
4840
const reactEmoji = '\u269B';
@@ -127,6 +119,15 @@ const getFiberLabel = (
127119
}
128120
};
129121

122+
const getFiberName = (fiber: Fiber): string | null => {
123+
if (fiber.tag === SimpleMemoComponent) {
124+
const innerName = getComponentName(fiber.type);
125+
return `Memo${innerName !== null ? `(${innerName})` : ''}`;
126+
}
127+
128+
return getComponentName(fiber.type);
129+
};
130+
130131
const beginFiberMark = (
131132
fiber: Fiber,
132133
phase: MeasurementPhase | null,

0 commit comments

Comments
 (0)