diff --git a/llama_stack/ui/hooks/usePagination.ts b/llama_stack/ui/hooks/usePagination.ts index 135754a77..98faa5f4d 100644 --- a/llama_stack/ui/hooks/usePagination.ts +++ b/llama_stack/ui/hooks/usePagination.ts @@ -55,6 +55,9 @@ export function usePagination({ // Use refs to avoid stale closures const stateRef = useRef(state); stateRef.current = state; + + // Track if initial data has been fetched + const hasFetchedInitialData = useRef(false); /** * Fetches data from the API with cursor-based pagination @@ -119,8 +122,12 @@ export function usePagination({ // Auto-load initial data on mount useEffect(() => { - fetchData(); - }, []); + if (!hasFetchedInitialData.current) { + hasFetchedInitialData.current = true; + fetchData(); + } + }, [fetchData]); + return { data: state.data,