Skip to content

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]

test(ui): cover user filter pagination

Daniel Meismer151bdbb2a9d6
diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx
index 0d50effabb4..fd53949c87a 100644
--- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx
@@ -135,6 +135,38 @@ describe("RequestLogsFilters", () => {
await waitFor(() => expect(useInfiniteUsers).toHaveBeenCalledWith(50, "[email protected]"));
});
+ it("loads the next page when the User ID list is scrolled near the end", async () => {
+ const fetchNextPage = vi.fn();
+ vi.mocked(useInfiniteUsers).mockReturnValue({
+ ...emptyInfiniteQuery,
+ fetchNextPage,
+ hasNextPage: true,
+ data: {
+ pages: [
+ {
+ users: [{ user_id: "user-1", user_alias: "Alice", user_email: "[email protected]" }],
+ page: 1,
+ page_size: 50,
+ total: 51,
+ total_pages: 2,
+ },
+ ],
+ pageParams: [1],
+ },
+ } as unknown as ReturnType<typeof useInfiniteUsers>);
+ const user = userEvent.setup();
+ renderFilters();
+
+ await user.click(await screen.findByPlaceholderText("Search an internal user"));
+ const list = await screen.findByTestId("paginated-search-select-list");
+ Object.defineProperty(list, "scrollTop", { value: 90, configurable: true });
+ Object.defineProperty(list, "clientHeight", { value: 10, configurable: true });
+ Object.defineProperty(list, "scrollHeight", { value: 100, configurable: true });
+ list.dispatchEvent(new Event("scroll", { bubbles: true }));
+
+ await waitFor(() => expect(fetchNextPage).toHaveBeenCalled());
+ });
+
it("does not show or query the User ID filter for non-admin request logs", () => {
renderFilters({}, false);