Skip to content

Commit 7b413aa

Browse files
authored
fix user profile metric updates between users (#2783)
1 parent 1b4bc31 commit 7b413aa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/HOCs/WithUserMetrics/WithUserMetrics.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export const WithUserMetrics = function (WrappedComponent, userProp) {
155155
}
156156

157157
componentDidUpdate(prevProps, prevState) {
158+
const userIdChanged = prevProps[userProp]?.id !== this.props[userProp]?.id;
158159
const scoreChanged = prevProps[userProp]?.score !== this.props[userProp]?.score;
159160
const {
160161
tasksCompletedMonthsPast,
@@ -165,7 +166,7 @@ export const WithUserMetrics = function (WrappedComponent, userProp) {
165166
tasksReviewerDateRange,
166167
} = this.state;
167168

168-
if (scoreChanged) {
169+
if (userIdChanged || scoreChanged) {
169170
this.updateAllMetrics();
170171
} else if (
171172
tasksReviewedMonthsPast !== CUSTOM_RANGE &&

0 commit comments

Comments
 (0)