-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Don’t render leftpanel stories tree if stories are empty #1664
Don’t render leftpanel stories tree if stories are empty #1664
Conversation
@@ -46,7 +46,9 @@ class LeftPanel extends Component { | |||
onChange={text => onStoryFilter(text)} | |||
/> | |||
<div style={scrollStyle}> | |||
{storiesHierarchy ? <Stories {...pick(this.props, storyProps)} /> : null} | |||
{storiesHierarchy && storiesHierarchy.map.size |
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.
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
selectedKind
andselectedStory
on 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/react
gets 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