Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions src/components/HOCs/WithReviewTasks/WithReviewTasks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,14 @@ export const WithReviewTasks = function (WrappedComponent) {
searchOnCriteria.invertFields = this.state.criteria[props.reviewTasksType].invertFields;
}

// Only apply defaults that would affect the URL if we're not skipping URL update
// This prevents adding default parameters to the URL on initial load
if (!skipURLUpdate) {
if (searchOnCriteria.savedChallengesOnly === undefined) {
searchOnCriteria.savedChallengesOnly =
this.state.criteria[this.props.reviewTasksType]?.savedChallengesOnly;
}
if (searchOnCriteria.excludeOtherReviewers === undefined) {
// Exclude reviews assigned to other reviewers by default
searchOnCriteria.excludeOtherReviewers =
this.state.criteria[this.props.reviewTasksType]?.excludeOtherReviewers ?? true;
}
} else {
// On initial load, preserve the original values or use existing state values
if (searchOnCriteria.savedChallengesOnly === undefined) {
searchOnCriteria.savedChallengesOnly =
this.state.criteria[this.props.reviewTasksType]?.savedChallengesOnly ?? false;
}
if (searchOnCriteria.excludeOtherReviewers === undefined) {
searchOnCriteria.excludeOtherReviewers =
this.state.criteria[this.props.reviewTasksType]?.excludeOtherReviewers ?? true;
}
if (searchOnCriteria.savedChallengesOnly === undefined) {
searchOnCriteria.savedChallengesOnly =
this.state.criteria[this.props.reviewTasksType]?.savedChallengesOnly;
}
if (searchOnCriteria.excludeOtherReviewers === undefined) {
// Exclude reviews assigned to other reviewers by default
searchOnCriteria.excludeOtherReviewers =
this.state.criteria[this.props.reviewTasksType]?.excludeOtherReviewers ?? true;
}

// We need to update our list of challenges since some challenges may
Expand Down Expand Up @@ -215,7 +201,6 @@ export const WithReviewTasks = function (WrappedComponent) {
);
}
this.setState({ criteria: stateCriteria });
this.update(this.props, criteria, true);
}

componentDidUpdate(prevProps) {
Expand Down