Skip to content

Commit

Permalink
restore leaderboards initial data sorted by "All Time"
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Jan 11, 2024
1 parent f92d48e commit a17a268
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/components/HOCs/WithLeaderboard/WithLeaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { fetchLeaderboard, fetchLeaderboardForUser, fetchReviewerLeaderboard,
*
* @author [Neil Rotstan](https://github.com/nrotstan)
*/
const WithCurrentLeaderboard = function(WrappedComponent, initialMonthsPast=1, initialOptions={}) {
class WithCurrentLeaderboardClass extends Component {
const WithLeaderboard = function(WrappedComponent, initialMonthsPast=1, initialOptions={}) {
return class extends Component {
state = {
leaderboard: null,
leaderboardLoading: false,
Expand Down Expand Up @@ -210,7 +210,8 @@ const WithCurrentLeaderboard = function(WrappedComponent, initialMonthsPast=1, i
render() {
const moreResults = this.state.leaderboard ? this.state.showingCount <= this.state.leaderboard.length : true

return <WrappedComponent {..._omit(this.props, ['fetchLeaderboard', 'fetchLeaderboardForUser', 'fetchReviewerLeaderboard'])}
return <WrappedComponent key={this.state.fetchId}
{..._omit(this.props, ['fetchLeaderboard', 'fetchLeaderboardForUser', 'fetchReviewerLeaderboard'])}
leaderboard={this.state.leaderboard}
leaderboardLoading={this.state.leaderboardLoading}
monthsPast={this.monthsPast()}
Expand All @@ -226,14 +227,9 @@ const WithCurrentLeaderboard = function(WrappedComponent, initialMonthsPast=1, i
{...this.props} />
}
}
return WithCurrentLeaderboardClass;
}

const mapDispatchToProps = (dispatch) => bindActionCreators({ fetchLeaderboard, fetchLeaderboardForUser, fetchReviewerLeaderboard }, dispatch)


const WithLeaderboard = (WrappedComponent) =>
connect(null, mapDispatchToProps)(WithCurrentLeaderboard(WrappedComponent))

export default WithLeaderboard

export default (WrappedComponent, initialMonthsPast, initialOptions) =>
connect(null, mapDispatchToProps)(WithLeaderboard(WrappedComponent, initialMonthsPast, initialOptions))

0 comments on commit a17a268

Please sign in to comment.