diff --git a/src/App.jsx b/src/App.jsx index adbafb7..05136ff 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -17,7 +17,10 @@ const App = () => { varsRef.current = { previousLocation }; useEffect(() => { - if (location.pathname !== varsRef.current.previousLocation.pathname) { + if ( + location.pathname !== varsRef.current.previousLocation.pathname || + location.search !== varsRef.current.previousLocation.search + ) { window.scrollTo(0, 0); } }, [location]); diff --git a/src/utils/challenge.js b/src/utils/challenge.js index 4ac03eb..dbd13e7 100644 --- a/src/utils/challenge.js +++ b/src/utils/challenge.js @@ -63,6 +63,12 @@ Joi.type = () => ) || null ); +Joi.validDate = () => + Joi.alternatives().try( + Joi.date(), + Joi.any().custom(() => null) + ); + export function getCurrencySymbol(prizeSets) { return constants.CURRENCY_SYMBOL[_.get(prizeSets, "[0].prizes[0].type", "")]; } @@ -141,8 +147,8 @@ const queryScheme = { tracks: Joi.array().items(Joi.track()), search: Joi.string(), tags: Joi.array().items(Joi.string()), - startDateEnd: Joi.date(), - endDateStart: Joi.date(), + startDateEnd: Joi.validDate(), + endDateStart: Joi.validDate(), sortBy: Joi.string().valid("updated", "overview.totalPrizes", "name"), groups: Joi.array().items(Joi.optionalId()).unique(), events: Joi.array().items(Joi.string()),