]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19604 Fix scrolling in Activity Page
authorJeremy Davis <jeremy.davis@sonarsource.com>
Mon, 26 Jun 2023 08:48:58 +0000 (10:48 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 26 Jun 2023 20:03:54 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.tsx

index 7d043a09ea0c597a60f2ebbd4cec58821b55e916..6ea2f6bf60a9bdf945c83efb9148485faaa66c48 100644 (file)
@@ -55,7 +55,15 @@ export default class ProjectActivityAnalysesList extends React.PureComponent<Pro
   scrollContainer?: HTMLUListElement | null;
 
   componentDidUpdate(prevProps: Props) {
-    if (this.scrollContainer && activityQueryChanged(prevProps.query, this.props.query)) {
+    const selectedDate = this.props.query.selectedDate
+      ? this.props.query.selectedDate.valueOf()
+      : null;
+
+    if (
+      this.scrollContainer &&
+      activityQueryChanged(prevProps.query, this.props.query) &&
+      !this.props.analyses.some(({ date }) => date.valueOf() === selectedDate)
+    ) {
       this.scrollContainer.scrollTop = 0;
     }
   }