fix(ui): ensure initial data fetch only happens once

# What does this PR do?


## Test Plan
This commit is contained in:
Eric Huang 2025-06-20 13:46:50 -07:00
parent d3b60507d7
commit 8c87715da5

View file

@ -56,6 +56,9 @@ export function usePagination<T>({
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<T>({
// Auto-load initial data on mount
useEffect(() => {
if (!hasFetchedInitialData.current) {
hasFetchedInitialData.current = true;
fetchData();
}, []);
}
}, [fetchData]);
return {
data: state.data,