Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(web): let the invitations page scroll when the list is long (#10563)
小妍儿 ✨98d4f5118985
diff --git a/apps/web/app/(auth)/invitations/page.test.tsx b/apps/web/app/(auth)/invitations/page.test.tsxnew file mode 100644index 0000000000..f18b2ca876--- /dev/null+++ b/apps/web/app/(auth)/invitations/page.test.tsx@@ -0,0 +1,37 @@+import { describe, it, expect, vi } from "vitest";+import { render, screen } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import InvitationsRoutePage from "./page";++vi.mock("next/navigation", () => ({+ useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),+}));++vi.mock("@multica/core/auth", () => ({+ useAuthStore: (selector: (s: { user: object; isLoading: boolean }) => unknown) =>+ selector({ user: { id: "u-1" }, isLoading: false }),+}));++vi.mock("@multica/core/api", () => ({+ api: { listWorkspaces: vi.fn().mockResolvedValue([]) },+}));++vi.mock("@multica/views/invitations", () => ({+ InvitationsPage: () => <div data-testid="invitations-page" />,+}));++describe("InvitationsRoutePage", () => {+ // The root layout sets `body { overflow: hidden }`, so a long invitation+ // list is only reachable if the route owns its scroll container.+ it("renders the invitations inside a page-owned scroll container", () => {+ const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ render(+ <QueryClientProvider client={qc}>+ <InvitationsRoutePage />+ </QueryClientProvider>,+ );++ const scroller = screen.getByTestId("invitations-page").parentElement!;+ expect(scroller).toHaveClass("h-full", "overflow-y-auto");+ });+});diff --git a/apps/web/app/(auth)/invitations/page.tsx b/apps/web/app/(auth)/invitations/page.tsxindex 1f14347a74..3fa2529ca6 100644--- a/apps/web/app/(auth)/invitations/page.tsx+++ b/apps/web/app/(auth)/invitations/page.tsx@@ -33,5 +33,11 @@ export default function InvitationsRoutePage() {const onBack =wsList.length > 0 ? () => router.push(paths.root()) : undefined;- return <InvitationsPage onBack={onBack} />;+ // The root layout sets `body { overflow: hidden }` (app-shell convention),+ // so the page owns its scroll; otherwise a long invitation list is cut off.+ return (+ <div className="h-full overflow-y-auto bg-background">+ <InvitationsPage onBack={onBack} />+ </div>+ );}diff --git a/apps/web/app/(auth)/invite/[id]/page.test.tsx b/apps/web/app/(auth)/invite/[id]/page.test.tsxnew file mode 100644index 0000000000..351638538d--- /dev/null+++ b/apps/web/app/(auth)/invite/[id]/page.test.tsx@@ -0,0 +1,38 @@+import { describe, it, expect, vi } from "vitest";+import { render, screen } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import InviteAcceptPage from "./page";++vi.mock("next/navigation", () => ({+ useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),+ useParams: () => ({ id: "inv-1" }),+}));++vi.mock("@multica/core/auth", () => ({+ useAuthStore: (selector: (s: { user: object; isLoading: boolean }) => unknown) =>+ selector({ user: { id: "u-1" }, isLoading: false }),+}));++vi.mock("@multica/core/api", () => ({+ api: { listWorkspaces: vi.fn().mockResolvedValue([]) },+}));++vi.mock("@multica/views/invitations", () => ({+ InvitationsPage: () => <div data-testid="invitations-page" />,+}));++describe("InviteAcceptPage", () => {+ // The root layout sets `body { overflow: hidden }`, so a long invitation+ // list is only reachable if the route owns its scroll container.+ it("renders the invitations inside a page-owned scroll container", () => {+ const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ render(+ <QueryClientProvider client={qc}>+ <InviteAcceptPage />+ </QueryClientProvider>,+ );++ const scroller = screen.getByTestId("invitations-page").parentElement!;+ expect(scroller).toHaveClass("h-full", "overflow-y-auto");+ });+});diff --git a/apps/web/app/(auth)/invite/[id]/page.tsx b/apps/web/app/(auth)/invite/[id]/page.tsxindex a35ed906a5..3caac8b154 100644--- a/apps/web/app/(auth)/invite/[id]/page.tsx+++ b/apps/web/app/(auth)/invite/[id]/page.tsx@@ -32,5 +32,11 @@ export default function InviteAcceptPage() {const onBack =wsList.length > 0 ? () => router.push(paths.root()) : undefined;- return <InvitationsPage invitationId={params.id} onBack={onBack} />;+ // The root layout sets `body { overflow: hidden }` (app-shell convention),+ // so the page owns its scroll; otherwise a long invitation list is cut off.+ return (+ <div className="h-full overflow-y-auto bg-background">+ <InvitationsPage invitationId={params.id} onBack={onBack} />+ </div>+ );}