-
Notifications
You must be signed in to change notification settings - Fork 252
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
Support sub-components assigned to default export #411
Support sub-components assigned to default export #411
Conversation
0bc4f8a
to
611854c
Compare
611854c
to
52afa6f
Compare
export default function Root(props: { name: string }) { | ||
return <span>root {props.name}</span>; | ||
} | ||
Root.displayName = 'Root'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to explicitly set displayName
here because, if I don't, the docgen incorrectly names this component SubComponent
(naming it after the file). I feel like it's tangentially related to #395.
description: '' | ||
} | ||
}, | ||
Sub: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the change below, the component names are Root
and default.Sub
, which is not correct.
fix: the merging of PR #411 introduced a regression error
fix: the merging of PR styleguidist#411 introduced a regression error
This prevents an issue where, when a component is the default export of a file, assigning any other component as a property causes the docgen to put
default
in the component's display name.This fixes #394 and upstream would fix hipstersmoothie/react-docgen-typescript-plugin#57. It's a somewhat naive fix, but it keeps the test suite passing.