Skip to content

Commit

Permalink
review clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
billyvg committed Mar 5, 2025
1 parent 8f4edca commit 60d4d0f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions static/app/utils/useReleaseStats.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useEffect, useRef} from 'react';
import {useEffect} from 'react';

import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
import {useInfiniteApiQuery} from 'sentry/utils/queryClient';
Expand Down Expand Up @@ -30,7 +30,6 @@ export function useReleaseStats(
queryOptions: {staleTime: number} = {staleTime: Infinity}
) {
const organization = useOrganization();
const currentNumberPages = useRef(0);

const {
isLoading,
Expand All @@ -56,15 +55,15 @@ export function useReleaseStats(
'load-all',
],
...queryOptions,
enabled: currentNumberPages.current < maxPages,
});

const currentNumberPages = data?.pages.length ?? 0;

useEffect(() => {
if (!isFetching && hasNextPage && currentNumberPages.current + 1 < maxPages) {
if (!isFetching && hasNextPage && currentNumberPages + 1 < maxPages) {
fetchNextPage();
currentNumberPages.current++;
}
}, [isFetching, hasNextPage, fetchNextPage, maxPages]);
}, [isFetching, hasNextPage, fetchNextPage, maxPages, currentNumberPages]);

return {
isLoading,
Expand Down

0 comments on commit 60d4d0f

Please sign in to comment.