function useInfiniteLoader(loadMoreItems, options) {
    if (options === void 0) {
      options = emptyObj$2
    }

    var _options = options,
      isItemLoaded = _options.isItemLoaded,
      _options$minimumBatch = _options.minimumBatchSize,
      minimumBatchSize =
        _options$minimumBatch === void 0 ? 16 : _options$minimumBatch,
      _options$threshold = _options.threshold,
      threshold = _options$threshold === void 0 ? 16 : _options$threshold,
      _options$totalItems = _options.totalItems,
      totalItems = _options$totalItems === void 0 ? 9e9 : _options$totalItems
    var storedLoadMoreItems = useLatest$4(loadMoreItems)
    var storedIsItemLoaded = useLatest$4(isItemLoaded)
    return React.useCallback(
      function (startIndex, stopIndex, items) {
        var unloadedRanges = scanForUnloadedRanges(
          storedIsItemLoaded.current,
          minimumBatchSize,
          items,
          totalItems,
          Math.max(0, startIndex - threshold),
          Math.min(totalItems - 1, (stopIndex || 0) + threshold)
        ) // The user is responsible for memoizing their loadMoreItems() function
        // because we don't want to make assumptions about how they want to deal
        // with `items`

        for (var i = 0; i < unloadedRanges.length - 1; ++i) {
          storedLoadMoreItems.current(
            unloadedRanges[i],
            unloadedRanges[++i],
            items
          )
        }
      },
      [
        totalItems,
        minimumBatchSize,
        threshold,
        storedLoadMoreItems,
        storedIsItemLoaded,
      ]
    )
  }
/**
   * A utility hook for seamlessly adding infinite scroll behavior to the `useMasonry()` hook. This
   * hook invokes a callback each time the last rendered index surpasses the total number of items
   * in your items array or the number defined in the `totalItems` option.
   *
   * @param loadMoreItems This callback is invoked when more rows must be loaded. It will be used to
   *  determine when to refresh the list with the newly-loaded data. This callback may be called multiple
   *  times in reaction to a single scroll event, so it's important to memoize its arguments. If you're
   *  creating this callback inside of a functional component, make sure you wrap it in `React.useCallback()`,
   *  as well.
   * @param options
   */
A utility hook for seamlessly adding infinite scroll behavior to the `useMasonry()` hook. This
hook invokes a callback each time the last rendered index surpasses the total number of items
in your items array or the number defined in the `totalItems` option.

@param loadMoreItems This callback is invoked when more rows must be loaded. It will be used to
determine when to refresh the list with the newly-loaded data. This callback may be called multiple
times in reaction to a single scroll event, so it's important to memoize its arguments. If you're
creating this callback inside of a functional component, make sure you wrap it in `React.useCallback()`,
as well.
@param options
A utility hook for seamlessly adding infinite scroll behavior to the ` useMasonry () ` hook . This hook invokes a callback each time the last rendered index surpasses the total number of items in your items array or the number defined in the ` totalItems ` option . @param loadMoreItems This callback is invoked when more rows must be loaded . It will be used to determine when to refresh the list with the newly - loaded data . This callback may be called multiple times in reaction to a single scroll event so it ' s important to memoize its arguments . If you ' re creating this callback inside of a functional component make sure you wrap it in ` React . useCallback () ` as well . @param options
function useInfiniteLoader(loadMoreItems, options) {
    if (options === void 0) {
      options = emptyObj$2
    }
    var _options = options,
      isItemLoaded = _options.isItemLoaded,
      _options$minimumBatch = _options.minimumBatchSize,
      minimumBatchSize =
        _options$minimumBatch === void 0 ? 16 : _options$minimumBatch,
      _options$threshold = _options.threshold,
      threshold = _options$threshold === void 0 ? 16 : _options$threshold,
      _options$totalItems = _options.totalItems,
      totalItems = _options$totalItems === void 0 ? 9e9 : _options$totalItems
    var storedLoadMoreItems = useLatest$4(loadMoreItems)
    var storedIsItemLoaded = useLatest$4(isItemLoaded)
    return React.useCallback(
      function (startIndex, stopIndex, items) {
        var unloadedRanges = scanForUnloadedRanges(
          storedIsItemLoaded.current,
          minimumBatchSize,
          items,
          totalItems,
          Math.max(0, startIndex - threshold),
          Math.min(totalItems - 1, (stopIndex || 0) + threshold)
        ) 
        for (var i = 0; i < unloadedRanges.length - 1; ++i) {
          storedLoadMoreItems.current(
            unloadedRanges[i],
            unloadedRanges[++i],
            items
          )
        }
      },
      [
        totalItems,
        minimumBatchSize,
        threshold,
        storedLoadMoreItems,
        storedIsItemLoaded,
      ]
    )
  }
function useInfiniteLoader ( loadMoreItems , options ) { if ( options === void 0 ) { options = emptyObj$2 } var _options = options , isItemLoaded = _options . isItemLoaded , _options$minimumBatch = _options . minimumBatchSize , minimumBatchSize = _options$minimumBatch === void 0 ? 16 : _options$minimumBatch , _options$threshold = _options . threshold , threshold = _options$threshold === void 0 ? 16 : _options$threshold , _options$totalItems = _options . totalItems , totalItems = _options$totalItems === void 0 ? 9e9 : _options$totalItems var storedLoadMoreItems = useLatest$4 ( loadMoreItems ) var storedIsItemLoaded = useLatest$4 ( isItemLoaded ) return React . useCallback ( function ( startIndex , stopIndex , items ) { var unloadedRanges = scanForUnloadedRanges ( storedIsItemLoaded . current , minimumBatchSize , items , totalItems , Math . max ( 0 , startIndex - threshold ) , Math . min ( totalItems - 1 , ( stopIndex || 0 ) + threshold ) ) for ( var i = 0 ; i < unloadedRanges . length - 1 ; ++ i ) { storedLoadMoreItems . current ( unloadedRanges [ i ] , unloadedRanges [ ++ i ] , items ) } } , [ totalItems , minimumBatchSize , threshold , storedLoadMoreItems , storedIsItemLoaded , ] ) }
A utility hook for seamlessly adding infinite scroll behavior to the `useMasonry()` hook.
A utility hook for seamlessly adding infinite scroll behavior to the ` useMasonry () ` hook .
// The user is responsible for memoizing their loadMoreItems() function // because we don't want to make assumptions about how they want to deal // with `items`