Skip to content

Commit 8578146

Browse files
committed
Fix findLatestPr to prioritize open PRs and remove unused icon imports
- findLatestPr: sort open PRs before merged/closed so the UI correctly detects existing open PRs and avoids offering duplicate 'Create PR' - Sidebar: remove unused MonitorIcon, MoonIcon, SunIcon imports
1 parent 37e17e9 commit 8578146

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎apps/server/src/gitManager.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ export class GitManager {
458458
}
459459

460460
const parsed = parsePullRequestList(parsedJson).toSorted((a, b) => {
461+
const aOpen = a.state === "open" ? 1 : 0;
462+
const bOpen = b.state === "open" ? 1 : 0;
463+
if (aOpen !== bOpen) return bOpen - aOpen;
461464
const left = a.updatedAt ? Date.parse(a.updatedAt) : 0;
462465
const right = b.updatedAt ? Date.parse(b.updatedAt) : 0;
463466
return right - left;

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
GitPullRequestIcon,
3-
MonitorIcon,
4-
MoonIcon,
5-
SunIcon,
6-
TerminalIcon,
7-
} from "lucide-react";
1+
import { GitPullRequestIcon, TerminalIcon } from "lucide-react";
82
import { useCallback, useEffect, useMemo, useState } from "react";
93
import type { ResolvedKeybindingsConfig } from "@t3tools/contracts";
104
import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/react-query";

0 commit comments

Comments
 (0)