Skip to content

Commit e2d9f0b

Browse files
committed
Avoid facet errors if there is no result
1 parent 9f0bd27 commit e2d9f0b

File tree

1 file changed

+11
-2
lines changed
  • src/containers/SequenceSearch/components/Results

1 file changed

+11
-2
lines changed

src/containers/SequenceSearch/components/Results/index.jsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Results extends React.Component {
7676
}
7777
{
7878
(this.props.status === "loading" || this.props.status === "success" || this.props.status === "partial_success") && [
79-
<h1 key={`results-header`} className="margin-top-large margin-bottom-large">Similar sequences: { this.props.status === "loading" ? <i className="animated infinite flash">...</i> : <small>{ this.props.hitCount } total</small> }</h1>,
79+
<h1 key={`results-header`} className="margin-top-large margin-bottom-large">Similar sequences: { this.props.status === "loading" ? <i className="animated infinite flash">...</i> : <small>{ this.props.hitCount }</small> }</h1>,
8080
<div key={`results-div`} className="small-12 medium-10 medium-push-2 columns">
8181
<section>
8282
{ this.props.entries.map((entry, index) => (
@@ -85,7 +85,16 @@ class Results extends React.Component {
8585
{(this.props.status === "success" || this.props.status === "partial_success") && (this.props.entries.length < this.props.hitCount) && (<a className="button small" onClick={this.props.onLoadMore} target="_blank">Load more</a>)}
8686
</section>
8787
</div>,
88-
<Facets key={`results-facets`} facets={ this.props.facets } selectedFacets={ this.props.selectedFacets } toggleFacet={ this.toggleFacet } ordering={ this.props.ordering } textSearchError={ this.props.textSearchError } />
88+
<div key={`results-facets`}>
89+
{ this.props.entries ?
90+
<Facets
91+
facets={ this.props.facets }
92+
selectedFacets={ this.props.selectedFacets }
93+
toggleFacet={ this.toggleFacet }
94+
ordering={ this.props.ordering }
95+
textSearchError={ this.props.textSearchError }
96+
/> : ''}
97+
</div>
8998
]
9099
}
91100
</div>

0 commit comments

Comments
 (0)