Skip to content

Commit afae1ef

Browse files
committed
Fix bug: list page get error when no query string
1 parent 3981fc3 commit afae1ef

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/shared/components/challenge-listing/Filters/ChallengeFilters.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,5 @@ ChallengeFilters.propTypes = {
183183
showTrackModal: PT.func.isRequired,
184184
trackModalShown: PT.bool.isRequired,
185185
validKeywords: PT.arrayOf(PT.string).isRequired,
186-
validSubtracks: PT.arrayOf(PT.string).isRequired,
186+
validSubtracks: PT.arrayOf(PT.shape()).isRequired,
187187
};

src/shared/routes/Topcoder/ChallengeListing.jsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ export default function ChallengeListingRoute() {
2727
/* TODO: This validation of start and end dates from query params
2828
* does the trick of removing invalid dates from URL at the client
2929
* side, but it actually should be done in the reducer as well. */
30-
if (query.filter && query.filter.startDate
31-
&& !moment(query.filter.startDate).isValid()) {
32-
delete query.filter.startDate;
30+
if (query) {
31+
if (query.filter && query.filter.startDate
32+
&& !moment(query.filter.startDate).isValid()) {
33+
delete query.filter.startDate;
34+
}
35+
if (query.filter && query.filter.endDate
36+
&& !moment(query.filter.endDate).isValid()) {
37+
delete query.filter.endDate;
38+
}
39+
updateQuery({ filter: query.filter });
3340
}
34-
if (query.filter && query.filter.endDate
35-
&& !moment(query.filter.endDate).isValid()) {
36-
delete query.filter.endDate;
37-
}
38-
updateQuery({ filter: query.filter });
3941

4042
const currencyFromUrl = _.get(query, 'currency');
4143
const prizeMode = currencyFromUrl && `money-${currencyFromUrl}`;

0 commit comments

Comments
 (0)