Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

memo components show as Unknown in the timings section of Chrome #1340

Closed
xaviergonz opened this issue Apr 26, 2019 · 3 comments
Closed

memo components show as Unknown in the timings section of Chrome #1340

xaviergonz opened this issue Apr 26, 2019 · 3 comments

Comments

@xaviergonz
Copy link

xaviergonz commented Apr 26, 2019

Given a component like

export const MyComponent = (p) => {...};
MyComponent.displayName = "MyComponent";

it shows properly as
image

but as soon as memo is added

export const MyComponent = memo((p) => {...});
MyComponent.displayName = "MyComponent";

it shows as Unknown instead
image

Note that both actually show properly on the tree explorer, the issue is only in the timings section of a performance recording in chrome.

@xaviergonz
Copy link
Author

xaviergonz commented Apr 26, 2019

I also noticed that if this is done instead

const _MyComponent = (p) => {...};
_MyComponent.displayName = "MyComponent";
export const MyComponent = memo(_MyComponent);

then the timings section will show "MyComponent", it is as if the timings section was showing the wrapped component displayName for memo components, completely ignoring its own displayName.

@bvaughn
Copy link
Contributor

bvaughn commented Jun 11, 2019

Hey @xaviergonz. This issue should be filed against the React repo (assuming it's still happening). DevTools does not control the user timings that are shown in your screenshot. 🙇

@xaviergonz
Copy link
Author

Thanks, just copied it to the react repo

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants