Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: server logic for create from React component #24881
feat: server logic for create from React component #24881
Changes from 34 commits
6c24bfa
2948dd7
73cb71f
0dbd568
0f4e836
d763e1f
a2626df
6eabeb3
6ba1695
9389037
d4e4c7d
a48491d
00e7819
df027ff
b32560f
89b823a
2f3ffcb
a631284
dbb5b3e
4ad474c
c0382fa
7456bb7
fadb8d9
6d502b1
f60ac0a
bd398ed
9510a85
77a4942
f9e8af7
68d5c87
281da0a
e4410b1
f12efca
e857b8f
c070f96
cd65233
9449d66
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
What happens for default export components, like
CounterDefault
? Would this becomeimport { CounterDefault } from './counter-default'
(which would be undefined). Did we find a solution for this, or are we moving forward with this as a known limitation?It should be possible to write a quick babel parser to find the default export and compare that to the components
react-docgen
found. Not sure how expensive this would be, probably not that much.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 think we'll need a separate spec template for default export components. I'm looking into how we can figure out if a component is exported by using a custom handler with React Docgen.
Otherwise yeah we can probably do it after we parse with React Docgen
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 looked at the result the
componentDefinition
which is what the handler receives and it doesn't contain enough info to determine how the component was exported. For example:The componentDef only contains info on
const Button = (props: {text: string}) => <button>{props.text}</button>
. Rather than a custom handler, I believe a custom resolver makes sense here so we can scrape all of the exported declarations and then compare them to the returned componentDefinitions. We don't need to write our own parser since a resolver directly receives the parsed ast.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.
Going to handle this as a separate task (to be completed before releasing this feature) #24929