@playlive/react-query
    Preparing search index...

    Function useInfiniteDonations

    • Cursor-aware paginated donations hook over TanStack's useInfiniteQuery. Tiltify uses an opaque string cursor; Twitch uses a numeric page index — the hook dispatches to the matching platform-specific fetcher and normalizes the getNext/getPrevious page params across both shapes.

      Twitch charity donations don't expose a reverse cursor, so getPreviousPageParam short-circuits to undefined on that path (hasPreviousPage is permanently false for Twitch).

      Options (all optional) are forwarded to TanStack:

      • maxPages — cap on retained pages; drops the oldest when reached.
      • initialData — pre-fetched pages; skips the initial loading state.
      • staleTime / refetchInterval / retry / retryDelay — pass through the standard UseFetchOptions knobs.
      • cachingEnabled — partitions the query cache; useful when the same campaign is fetched with and without cache-busting query params.

      Parameters

      Returns UseInfiniteDonationsResult<
          PaginatedResponse<
              TiltifyDonation,
              TiltifyPaginationMetadata
              | TwitchPaginationMetadata,
          >,
      >

      const {
      data, fetchNextPage, hasNextPage, isFetchingNextPage,
      fetchPreviousPage, hasPreviousPage,
      } = useInfiniteDonations(
      { charityType: "tiltify", campaignId },
      { maxPages: 5, initialData: seededPages },
      );

      useEffect(() => {
      if (hasNextPage && !isFetchingNextPage) void fetchNextPage();
      }, [hasNextPage, isFetchingNextPage, fetchNextPage]);