Skip to content

Commit

Permalink
fix: hide component stats button if no stats available
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 9, 2021
1 parent 2ec1ca2 commit c75d859
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui/blocks/src/ComponentSource/BaseComponentSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const getNextState = (current: ShowType, component: Component): ShowType => {
case 'import':
return component.source
? 'source'
: component.fileInfo
: component.fileInfo?.sloc
? 'stats'
: 'import';
case 'source':
return component.fileInfo ? 'stats' : 'import';
return component.fileInfo?.sloc ? 'stats' : 'import';
case 'stats':
default:
return 'import';
Expand Down Expand Up @@ -65,7 +65,7 @@ export const BaseComponentSource: FC<BaseComponentSourceProps> = props => {
};
const allActions: ActionItem[] = [];

if (component.source || component.fileInfo) {
if (component.source || component.fileInfo?.sloc) {
allActions.push({
node: getNextState(showType, component),
'aria-label': `view ${component.name} ${getNextState(
Expand Down

0 comments on commit c75d859

Please sign in to comment.