Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(issues): add done issue pagination to list view (#545)

Bohan Jianga135c44838d1
diff --git a/packages/views/issues/components/board-view.tsx b/packages/views/issues/components/board-view.tsx
index ce7b9da169..f396c75147 100644
--- a/packages/views/issues/components/board-view.tsx
+++ b/packages/views/issues/components/board-view.tsx
@@ -15,7 +15,7 @@ import {
type DragOverEvent,
} from "@dnd-kit/core";
import { arrayMove } from "@dnd-kit/sortable";
-import { Eye, Loader2, MoreHorizontal } from "lucide-react";
+import { Eye, MoreHorizontal } from "lucide-react";
import type { Issue, IssueStatus } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
import { useLoadMoreDoneIssues } from "@multica/core/issues/mutations";
@@ -32,30 +32,7 @@ import { sortIssues } from "../utils/sort";
import { StatusIcon } from "./status-icon";
import { BoardColumn } from "./board-column";
import { BoardCardContent } from "./board-card";
-
-/** Sentinel that triggers `onVisible` when scrolled into view. */
-function InfiniteScrollSentinel({ onVisible, loading }: { onVisible: () => void; loading: boolean }) {
- const sentinelRef = useRef<HTMLDivElement>(null);
- const onVisibleRef = useRef(onVisible);
- onVisibleRef.current = onVisible;
-
- useEffect(() => {
- const node = sentinelRef.current;
- if (!node) return;
- const observer = new IntersectionObserver(
- ([entry]) => { if (entry?.isIntersecting) onVisibleRef.current(); },
- { rootMargin: "100px" },
- );
- observer.observe(node);
- return () => observer.disconnect();
- }, []);
-
- return (
- <div ref={sentinelRef} className="flex items-center justify-center py-2">
- {loading && <Loader2 className="size-3 animate-spin text-muted-foreground" />}
- </div>
- );
-}
+import { InfiniteScrollSentinel } from "./infinite-scroll-sentinel";
const COLUMN_IDS = new Set<string>(ALL_STATUSES);
diff --git a/packages/views/issues/components/infinite-scroll-sentinel.tsx b/packages/views/issues/components/infinite-scroll-sentinel.tsx
new file mode 100644
index 0000000000..c0b77059b4
--- /dev/null
+++ b/packages/views/issues/components/infinite-scroll-sentinel.tsx
@@ -0,0 +1,28 @@
+"use client";
+
+import { useEffect, useRef } from "react";
+import { Loader2 } from "lucide-react";
+
+/** Sentinel that triggers `onVisible` when scrolled into view. */
+export function InfiniteScrollSentinel({ onVisible, loading }: { onVisible: () => void; loading: boolean }) {
+ const sentinelRef = useRef<HTMLDivElement>(null);
+ const onVisibleRef = useRef(onVisible);
+ onVisibleRef.current = onVisible;
+
+ useEffect(() => {
+ const node = sentinelRef.current;
+ if (!node) return;
+ const observer = new IntersectionObserver(
+ ([entry]) => { if (entry?.isIntersecting) onVisibleRef.current(); },
+ { rootMargin: "100px" },
+ );
+ observer.observe(node);
+ return () => observer.disconnect();
+ }, []);
+
+ return (
+ <div ref={sentinelRef} className="flex items-center justify-center py-2">
+ {loading && <Loader2 className="size-3 animate-spin text-muted-foreground" />}
+ </div>
+ );
+}
diff --git a/packages/views/issues/components/list-view.tsx b/packages/views/issues/components/list-view.tsx
index ba0a296127..1ec18f71e9 100644
--- a/packages/views/issues/components/list-view.tsx
+++ b/packages/views/issues/components/list-view.tsx
@@ -6,6 +6,7 @@ import { Accordion } from "@base-ui/react/accordion";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import { Button } from "@multica/ui/components/ui/button";
import type { Issue, IssueStatus } from "@multica/core/types";
+import { useLoadMoreDoneIssues } from "@multica/core/issues/mutations";
import { STATUS_CONFIG } from "@multica/core/issues/config";
import { useModalStore } from "@multica/core/modals";
import { useViewStore } from "@multica/core/issues/stores/view-store-context";
@@ -13,6 +14,7 @@ import { useIssueSelectionStore } from "@multica/core/issues/stores/selection-st
import { sortIssues } from "../utils/sort";
import { StatusIcon } from "./status-icon";
import { ListRow } from "./list-row";
+import { InfiniteScrollSentinel } from "./infinite-scroll-sentinel";
export function ListView({
issues,
@@ -32,6 +34,7 @@ export function ListView({
const selectedIds = useIssueSelectionStore((s) => s.selectedIds);
const select = useIssueSelectionStore((s) => s.select);
const deselect = useIssueSelectionStore((s) => s.deselect);
+ const { loadMore, hasMore, isLoading: loadingMore, doneTotal } = useLoadMoreDoneIssues();
const issuesByStatus = useMemo(() => {
const map = new Map<IssueStatus, Issue[]>();
@@ -101,7 +104,7 @@ export function ListView({
{cfg.label}
</span>
<span className="text-xs text-muted-foreground">
- {statusIssues.length}
+ {status === "done" ? doneTotal : statusIssues.length}
</span>
</Accordion.Trigger>
<div className="pr-2">
@@ -128,9 +131,14 @@ export function ListView({
</Accordion.Header>
<Accordion.Panel className="pt-1">
{statusIssues.length > 0 ? (
- statusIssues.map((issue) => (
- <ListRow key={issue.id} issue={issue} />
- ))
+ <>
+ {statusIssues.map((issue) => (
+ <ListRow key={issue.id} issue={issue} />
+ ))}
+ {status === "done" && hasMore && (
+ <InfiniteScrollSentinel onVisible={loadMore} loading={loadingMore} />
+ )}
+ </>
) : (
<p className="py-6 text-center text-xs text-muted-foreground">
No issues