Skip to content

Commit b579dac

Browse files
committed
fix branch delete
1 parent 24cbbff commit b579dac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/fern-dashboard/src/components/docs-page/BranchList.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ export function BranchList({ docsUrl, sourceRepo }: { docsUrl: DocsUrl; sourceRe
1515
const orgName = useOrgName();
1616
const router = useRouter();
1717

18+
const [deletedBranches, setDeletedBranches] = useState<Set<string>>(new Set());
19+
1820
const { deleteBranch, loading } = useLocalBranches();
1921
const { filteredBranches } = useLocalBranchesForSite(docsUrl);
2022

2123
// Pagination state
2224
const [visibleCount, setVisibleCount] = useState(3);
23-
// const [deletedBranches, setDeletedBranches] = useState<Set<string>>(new Set());
2425
const BRANCHES_PER_PAGE = 3;
2526

2627
const handleBranchClick = (branchName: string) => {
@@ -35,6 +36,7 @@ export function BranchList({ docsUrl, sourceRepo }: { docsUrl: DocsUrl; sourceRe
3536

3637
const handleBranchDelete = (branchName: string) => {
3738
deleteBranch(branchName);
39+
setDeletedBranches((prev) => new Set(prev).add(branchName));
3840
if (visibleCount > filteredBranches.length) {
3941
setVisibleCount(filteredBranches.length);
4042
}
@@ -45,9 +47,9 @@ export function BranchList({ docsUrl, sourceRepo }: { docsUrl: DocsUrl; sourceRe
4547
};
4648

4749
// Filter out deleted branches and get the branches to display (first N branches)
48-
// const availableBranches = branches.filter((branch) => !deletedBranches.has(branch));
49-
const visibleBranches = filteredBranches.slice(0, visibleCount);
50-
const hasMoreBranches = visibleCount < filteredBranches.length;
50+
const availableBranches = filteredBranches.filter((branch) => !deletedBranches.has(branch.branchName));
51+
const visibleBranches = availableBranches.slice(0, visibleCount);
52+
const hasMoreBranches = visibleCount < availableBranches.length;
5153

5254
return (
5355
<>
@@ -73,10 +75,8 @@ export function BranchList({ docsUrl, sourceRepo }: { docsUrl: DocsUrl; sourceRe
7375
)}
7476
</div>
7577
) : (
76-
<div className="py-8 text-center">
77-
<p className="dark:text-gray-1200 text-gray-500">
78-
{loading ? "Loading..." : "No open sessions found"}
79-
</p>
78+
<div className="text-center">
79+
<p className="text-muted-foreground">{loading ? "Loading..." : "No open sessions found"}</p>
8080
</div>
8181
)}
8282
</>

0 commit comments

Comments
 (0)