Skip to content

Commit 847a6fe

Browse files
committed
fix: no challenges found
1 parent 6d3464c commit 847a6fe

File tree

2 files changed

+14
-7
lines changed
  • src/shared
    • components/challenge-listing/Listing
    • containers/challenge-listing/Listing

2 files changed

+14
-7
lines changed

src/shared/components/challenge-listing/Listing/index.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import CardPlaceholder from '../placeholders/ChallengeCard';
1717
import './style.scss';
1818

1919
// const Filter = challengeUtils.filter;
20+
const LOADING_MESSAGE = 'Loading Challenges';
2021

2122
function Listing({
2223
activeBucket,
@@ -258,7 +259,14 @@ function Listing({
258259
loading
259260
? placeholders
260261
: (!filterState.recommended || activeBucket !== 'openForRegistration') && (
261-
<div styleName="no-results">{ `${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}` }</div>
262+
<div styleName="no-results">
263+
{
264+
needLoad ? LOADING_MESSAGE
265+
: (
266+
`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`
267+
)
268+
}
269+
</div>
262270
)
263271
}
264272
</div>

src/shared/containers/challenge-listing/Listing/index.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ export class ListingContainer extends React.Component {
6666
filter,
6767
} = this.props;
6868

69-
const { needLoad } = this.state;
70-
7169
markHeaderMenu();
7270

7371
if (queryBucket !== activeBucket && _.includes(BUCKETS, queryBucket)) {
@@ -107,10 +105,6 @@ export class ListingContainer extends React.Component {
107105
});
108106
}
109107
// }
110-
111-
if (needLoad) {
112-
this.setState({ needLoad: false });
113-
}
114108
}
115109

116110
componentDidUpdate(prevProps) {
@@ -140,6 +134,7 @@ export class ListingContainer extends React.Component {
140134
getPastChallenges,
141135
filterState,
142136
} = this.props;
137+
const { needLoad } = this.state;
143138
const oldUserId = _.get(prevProps, 'auth.user.userId');
144139
const userId = _.get(this.props, 'auth.user.userId');
145140
const handle = _.get(auth, 'user.handle');
@@ -264,6 +259,10 @@ export class ListingContainer extends React.Component {
264259
}
265260
if (filterChanged(filter, prevProps.filter)) {
266261
this.reloadChallenges();
262+
if (needLoad) {
263+
// eslint-disable-next-line react/no-did-update-set-state
264+
this.setState({ needLoad: false });
265+
}
267266
}
268267
setTimeout(() => {
269268
selectBucketDone();

0 commit comments

Comments
 (0)