diff --git a/src/hooks/useInfiniteCreatorMarketplace.ts b/src/hooks/useInfiniteCreatorMarketplace.ts index 5a7929d..141c4e2 100644 --- a/src/hooks/useInfiniteCreatorMarketplace.ts +++ b/src/hooks/useInfiniteCreatorMarketplace.ts @@ -36,6 +36,9 @@ export function useInfiniteCreatorMarketplace(params?: Omit { + if (import.meta.env.MODE === 'test') return; + if (!query.data) return; + + const currentPages = query.data.pages; + // Log if page count increased and it wasn't the initial load + if (currentPages.length > pageCountRef.current && pageCountRef.current > 0) { + const lastPage = currentPages[currentPages.length - 1]; + console.debug('[infinite-scroll-next-page]', { + cursor: lastPage.page, + results_fetched: lastPage.items.length, + has_more: lastPage.hasMore, + fetched_at: new Date().toISOString(), + }); + } + pageCountRef.current = currentPages.length; + }, [query.data]); + // De-duplicate creators across pages by id -- a creator that shifts // position between page fetches (e.g. sort order changing as data // updates) should never be rendered twice.