fix parsing displayName for components defined using function expression#516
fix parsing displayName for components defined using function expression#516radnan wants to merge 2 commits intostyleguidist:masterfrom
Conversation
|
Could you give me an example of a file that would fail? I am surprised we don't have it in our test suite. Did these multiple function expressions in the single file ever work? |
| assert.equal(parsed.displayName, 'StatelessDisplayName'); | ||
| }); | ||
|
|
||
| it('should be taken from stateless component `displayName` property (using named export and function expression)', () => { |
There was a problem hiding this comment.
Could you give me an example of a file that would fail? I am surprised we don't have it in our test suite.
Did these multiple function expressions in the single file ever work?
added a test to showcase how existing behavior is broken - it's not really related to exporting single or multiple components (you really shouldn't be exporting multiple components in same file in the first place 😛 )
rather just that if you use traditional function expression instead of arrow expression the computeComponentName is no longer working because of the additional flowNodeNameEscapedText check
regression from #449
displayName for functions that are defined using function expression are no longer working correctly
not familiar enough with the codebase to figure out the actual problem - but for now this fix will work if you have only one function expression in the file - but will break in the edge case where you have more than one function expression components - probly related to how function components are resolved from some other change