]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21436 Fix issues show more logic
authorViktor Vorona <viktor.vorona@sonarsource.com>
Wed, 17 Jan 2024 14:42:28 +0000 (15:42 +0100)
committersonartech <sonartech@sonarsource.com>
Thu, 18 Jan 2024 20:03:23 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-it.tsx
server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx

index 49633d8a9bf688a3d418a866882f4472b79c7a96..e707d9741fd512350b6ab9b4af09a02bbb4a9b32 100644 (file)
@@ -208,12 +208,12 @@ describe('issues app', () => {
       renderIssueApp();
 
       expect(await ui.issueItems.findAll()).toHaveLength(7);
-      expect(ui.issueItem9.query()).not.toBeInTheDocument();
+      expect(ui.issueItem8.query()).not.toBeInTheDocument();
 
       await user.click(screen.getByRole('button', { name: 'show_more' }));
 
-      expect(ui.issueItems.getAll()).toHaveLength(9);
-      expect(ui.issueItem9.get()).toBeInTheDocument();
+      expect(ui.issueItems.getAll()).toHaveLength(10);
+      expect(ui.issueItem8.get()).toBeInTheDocument();
     });
 
     it('should be able to select issues for bulk change', async () => {
index 228297a622f981ab1fefa22df124568f92646755..701f313f5ada218c27919cf9165ec2f6f897fc9f 100644 (file)
@@ -644,7 +644,7 @@ export class App extends React.PureComponent<Props, State> {
   };
 
   fetchMoreIssues = async () => {
-    const { paging } = this.state;
+    const { paging, issues } = this.state;
 
     if (!paging) {
       throw new Error('Paging is not defined');
@@ -658,7 +658,7 @@ export class App extends React.PureComponent<Props, State> {
       // In some cases, we can get an issue that we already have in the list as the first issue
       // When this happens, we filter it out
       // @see this.fetchIssuesUntil
-      const firstIssueKey = response.issues[0]?.key;
+      const firstIssueKey = issues[0]?.key;
       response.issues = response.issues.filter((issue) => issue.key !== firstIssueKey);
 
       if (this.mounted) {