Skip to content

Commit

Permalink
Fix getFiberName not considering displayName
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Aug 29, 2019
1 parent ada00bf commit 2c6088e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/react-reconciler/src/ReactDebugFiberPerf.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ const getFiberLabel = (

const getFiberName = (fiber: Fiber): string | null => {
if (fiber.tag === SimpleMemoComponent) {
const innerName = getComponentName(fiber.type);
return `Memo${innerName !== null ? `(${innerName})` : ''}`;
return getComponentName(fiber.elementType);
}

return getComponentName(fiber.type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,14 @@ describe('ReactDebugFiberPerf', () => {
const MemoFoo = React.memo(function Foo() {
return <div />;
});
const MemoBar = React.memo(function Bar() {
return <span />;
});
MemoBar.displayName = 'NamedBar';
ReactNoop.render(
<Parent>
<MemoFoo />
<MemoBar />
</Parent>,
);
expect(Scheduler).toFlushWithoutYielding();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ exports[`ReactDebugFiberPerf supports memo 1`] = `
"⚛ (React Tree Reconciliation: Completed Root)
⚛ Parent [mount]
⚛ Memo(Foo) [mount]
⚛ NamedBar [mount]
⚛ (Committing Changes)
⚛ (Committing Snapshot Effects: 0 Total)
Expand Down

0 comments on commit 2c6088e

Please sign in to comment.