Skip to content

Commit 3ccaa13

Browse files
Fix pr #14: Fix issue #13: Add the option to sort PRs
1 parent 3321885 commit 3ccaa13

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/PullRequestViewer.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
import React from 'react';
4-
import { render, screen, fireEvent } from '@testing-library/react';
4+
import { render, screen } from '@testing-library/react';
55
import userEvent from '@testing-library/user-event';
66
import PullRequestViewer from './PullRequestViewer';
77

src/PullRequestViewer.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22

3-
43
import React, { useState, useEffect } from 'react';
54
import { Octokit } from '@octokit/rest';
65
import Select from 'react-select';
@@ -52,7 +51,7 @@ const PullRequestViewer: React.FC = () => {
5251
org: GITHUB_ORG,
5352
type: 'all',
5453
});
55-
const repoOptions = response.data.map(repo => ({
54+
const repoOptions = response.data.map((repo) => ({
5655
value: repo.name,
5756
label: repo.name,
5857
}));
@@ -68,7 +67,7 @@ const PullRequestViewer: React.FC = () => {
6867
const fetchPullRequests = async () => {
6968
if (selectedRepo) {
7069
try {
71-
let allPullRequests: PullRequest[] = [];
70+
const allPullRequests: PullRequest[] = [];
7271
let page = 1;
7372
let hasNextPage = true;
7473

@@ -78,10 +77,10 @@ const PullRequestViewer: React.FC = () => {
7877
repo: selectedRepo.value,
7978
state: 'open',
8079
per_page: 100,
81-
page: page,
80+
page,
8281
});
8382

84-
allPullRequests = [...allPullRequests, ...response.data];
83+
allPullRequests.push(...response.data);
8584

8685
if (response.data.length < 100) {
8786
hasNextPage = false;

0 commit comments

Comments
 (0)