Don’t render leftpanel stories tree if stories are empty#1664
Conversation
| /> | ||
| <div style={scrollStyle}> | ||
| {storiesHierarchy ? <Stories {...pick(this.props, storyProps)} /> : null} | ||
| {storiesHierarchy && storiesHierarchy.map.size |
There was a problem hiding this comment.
It worth extracting this to a function for readability
Codecov Report
@@ Coverage Diff @@
## master #1664 +/- ##
==========================================
+ Coverage 21.11% 21.15% +0.03%
==========================================
Files 247 247
Lines 5580 5579 -1
Branches 672 669 -3
==========================================
+ Hits 1178 1180 +2
- Misses 3896 3910 +14
+ Partials 506 489 -17
Continue to review full report at Codecov.
|
|
By the way, concerning the codebeat issue: is that something I should fix or is it acceptable because it's a React component render function? |
|
Usually we look into these issues, but it depends. @ndelangen, what do you think about this case ? I don't see how it can be improved =) |
|
Thank you for this PR @danielsneijers ! The tools like codebeat are helpers to stay alert. I'm not aiming for 100% score in a list of arbitrary code-analytics tools. The point is to make reviews easier and keep us aware of issues we could solve when we touch code. Great job on this PR! |
|
Happy to help. Just to clarify, is any action needed from me (codebeat and circleci are still pending) or is one of the owners/members responsible for the updating and merging from this point? |
|
Nothing else is required to get this merged, your work on this PR is done! Will merge it! |
Issue: Fixes #1588, Warnings about missing
selectedKindandselectedStoryon initial page render.What I did
Stopped the LeftPanel from trying to render a Stories hierarchy tree when there are no stories to render.
Code in client init script of
@storybook/reactgets executed after LeftPanel gets mounted, so tweaking the code in the react client init script as suggested by @edoroshenko did not have any effect. Instead of making the propTypes in the Stories tree optional it seems more logical to not render it at all when there's no content to render.How to test