Skip to content

Commit

Permalink
fix(Virtualizer): add Loadable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS committed Dec 11, 2024
1 parent 04be85a commit c1fd5a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/lab/Virtualizer/Virtualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {defaultRangeExtractor, useVirtualizer} from '@tanstack/react-virtual';

import {useForkRef} from '../../../hooks';
import type {Key} from '../../types';
import type {Loadable} from '../Collection/Collection';

import {useLoadMore} from './useLoadMore';
import type {Loadable} from './useLoadMore';

type Item = {index: number; key: Key};

Expand Down
7 changes: 5 additions & 2 deletions src/components/lab/Virtualizer/useLoadMore.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from 'react';

interface LoadMoreOptions {
/** Whether the data is currently loading. */
export interface Loadable {
/** Whether the items are currently loading. */
loading?: boolean;
/** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */
onLoadMore?: () => void;
}

export interface LoadMoreOptions extends Loadable {
/**
* The amount of offset from bottom that should trigger load more.
* The value is multiplied to the size of the visible area.
Expand Down

0 comments on commit c1fd5a0

Please sign in to comment.