Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle advanced naming cases #81

Closed
wants to merge 1 commit into from

Conversation

gabriel-kohen-by
Copy link

@gabriel-kohen-by gabriel-kohen-by commented Aug 25, 2021

In some frameworks such as Material UI the name is indeed in a name object properties but usually masquerades inside the renderer function.
I've pointed to analyzing the render function name as a possible match.
image

Maybe in the future we can create a new signature of the match function where you can specify which nested property within the component name might hold the name of the component instead of hard coding it.
This is somewhat related to #17 but not quite.
We found that in many cases React Dev Tools will display the proper name of the component but I could still not find it with resq.
I think React DevTools is using something similar to resolve the component name even when it's a renderer function.
image
FYI: @baruchvlz and @christian-bromann

In some frameworks such as Material UI the name is indeed in a name object properties but usually masquerades inside the renderer function.
I've pointed to analyzing the render function name as a possible match.
Comment on lines +291 to +292
if (child.name.render !== undefined && child.name.render.name !== null &&
typeof child.name.render.name === 'string') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (child.name.render !== undefined && child.name.render.name !== null &&
typeof child.name.render.name === 'string') {
if (child.name.render && child.name.render.name) {

I don't think there's a need to check if the name is a string.

@baruchvlz
Copy link
Owner

Thanks for taking care of this, could you please also add some tests to check for these cases?

@baruchvlz
Copy link
Owner

Closing as stale.

@baruchvlz baruchvlz closed this May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants