mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
Fix Unbounded pagination
This commit is contained in:
parent
6d98622923
commit
f44c36f980
2 changed files with 5 additions and 2 deletions
|
|
@ -25,6 +25,8 @@ export const fetchTeamFilterOptions = async (
|
|||
const organizationIds = new Set<string>();
|
||||
const userMap = new Map<string, string>(); // user_id -> user_email
|
||||
|
||||
const MAX_PAGES = 1; // Cap at 20 keys on load to avoid heavy fetches
|
||||
const PAGE_SIZE = 20;
|
||||
let page = 1;
|
||||
let totalPages = 1;
|
||||
|
||||
|
|
@ -37,7 +39,7 @@ export const fetchTeamFilterOptions = async (
|
|||
null,
|
||||
null,
|
||||
page,
|
||||
100,
|
||||
PAGE_SIZE,
|
||||
null,
|
||||
null,
|
||||
"user",
|
||||
|
|
@ -64,7 +66,7 @@ export const fetchTeamFilterOptions = async (
|
|||
}
|
||||
|
||||
page++;
|
||||
} while (page <= totalPages);
|
||||
} while (page <= totalPages && page <= MAX_PAGES);
|
||||
|
||||
return {
|
||||
keyAliases: Array.from(keyAliases).sort(),
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
|
|||
queryKey: ["teamFilterOptions", teamId],
|
||||
queryFn: async () => fetchTeamFilterOptions(accessToken, teamId),
|
||||
enabled: !!accessToken && !!teamId,
|
||||
staleTime: 30000, // 30 seconds - align with useKeys
|
||||
});
|
||||
const teamFilterOptions = teamFilterOptionsQuery.data || {
|
||||
keyAliases: [],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue