Skip to content

Commit fad371b

Browse files
authored
fix initial filters bug on review table (#2678)
1 parent b0ba74d commit fad371b

1 file changed

Lines changed: 8 additions & 23 deletions

File tree

src/components/HOCs/WithReviewTasks/WithReviewTasks.jsx

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,14 @@ export const WithReviewTasks = function (WrappedComponent) {
8282
searchOnCriteria.invertFields = this.state.criteria[props.reviewTasksType].invertFields;
8383
}
8484

85-
// Only apply defaults that would affect the URL if we're not skipping URL update
86-
// This prevents adding default parameters to the URL on initial load
87-
if (!skipURLUpdate) {
88-
if (searchOnCriteria.savedChallengesOnly === undefined) {
89-
searchOnCriteria.savedChallengesOnly =
90-
this.state.criteria[this.props.reviewTasksType]?.savedChallengesOnly;
91-
}
92-
if (searchOnCriteria.excludeOtherReviewers === undefined) {
93-
// Exclude reviews assigned to other reviewers by default
94-
searchOnCriteria.excludeOtherReviewers =
95-
this.state.criteria[this.props.reviewTasksType]?.excludeOtherReviewers ?? true;
96-
}
97-
} else {
98-
// On initial load, preserve the original values or use existing state values
99-
if (searchOnCriteria.savedChallengesOnly === undefined) {
100-
searchOnCriteria.savedChallengesOnly =
101-
this.state.criteria[this.props.reviewTasksType]?.savedChallengesOnly ?? false;
102-
}
103-
if (searchOnCriteria.excludeOtherReviewers === undefined) {
104-
searchOnCriteria.excludeOtherReviewers =
105-
this.state.criteria[this.props.reviewTasksType]?.excludeOtherReviewers ?? true;
106-
}
85+
if (searchOnCriteria.savedChallengesOnly === undefined) {
86+
searchOnCriteria.savedChallengesOnly =
87+
this.state.criteria[this.props.reviewTasksType]?.savedChallengesOnly;
88+
}
89+
if (searchOnCriteria.excludeOtherReviewers === undefined) {
90+
// Exclude reviews assigned to other reviewers by default
91+
searchOnCriteria.excludeOtherReviewers =
92+
this.state.criteria[this.props.reviewTasksType]?.excludeOtherReviewers ?? true;
10793
}
10894

10995
// We need to update our list of challenges since some challenges may
@@ -215,7 +201,6 @@ export const WithReviewTasks = function (WrappedComponent) {
215201
);
216202
}
217203
this.setState({ criteria: stateCriteria });
218-
this.update(this.props, criteria, true);
219204
}
220205

221206
componentDidUpdate(prevProps) {

0 commit comments

Comments
 (0)