The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(ui): pin memory table page-size behavior on the last page
Yuneng Jiangff8d8797dd95
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsxindex 0dcbd6796a8..f664c650cd4 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsx@@ -1,6 +1,7 @@import { PaginationState } from "@tanstack/react-table";import { render, screen, within } from "@testing-library/react";import userEvent from "@testing-library/user-event";+import React, { useState } from "react";import { describe, expect, it, vi } from "vitest";import { MemoryRow } from "@/components/networking";@@ -134,6 +135,31 @@ describe("MemoryTable", () => {expect(onRefresh).toHaveBeenCalledTimes(1);});+ it("keeps the page in range when the rows-per-page selector shrinks the page count", async () => {+ const user = userEvent.setup();+ const rowCount = 120;+ const seen: PaginationState[] = [];++ function Harness() {+ const [pagination, setPagination] = useState<PaginationState>({ pageIndex: 4, pageSize: 25 });+ seen.push(pagination);+ return (+ <MemoryTable {...baseProps} rowCount={rowCount} pagination={pagination} onPaginationChange={setPagination} />+ );+ }++ render(<Harness />);+ expect(screen.getByTestId("pagination-page")).toHaveTextContent("Page 5 of 5");++ await user.click(screen.getByTestId("pagination-page-size"));+ await user.click(await screen.findByRole("option", { name: "100" }));++ const final = seen[seen.length - 1];+ expect(final.pageSize).toBe(100);+ expect(final.pageIndex).toBeLessThanOrEqual(Math.ceil(rowCount / final.pageSize) - 1);+ expect(screen.getByTestId("pagination-page")).toHaveTextContent("Page 2 of 2");+ });+it("renders secondary id and date cells for the row", () => {render(<MemoryTable {...baseProps} data={[makeMemory({ user_id: "user-42", team_id: "team-7" })]} />);const table = screen.getByRole("table");