Skip to content

Commit

Permalink
move condition
Browse files Browse the repository at this point in the history
  • Loading branch information
zaknesler committed May 18, 2024
1 parent b1341eb commit c13ca38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ui/src/components/entry/entry-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const EntryList: Component<EntryListProps> = props => {
createEffect(() => {
const bottomOfListVisible =
props.containerBounds?.bottom && listBounds.bottom && listBounds.bottom <= props.containerBounds?.bottom;
if (!bottomOfListVisible || !entries.query.hasNextPage) return;
if (!bottomOfListVisible) return;

entries.fetchMore();
});
Expand Down
4 changes: 3 additions & 1 deletion ui/src/hooks/queries/use-infinite-entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const useInfiniteEntries = () => {
const getAllEntries = () => query.data?.pages.flatMap(page => page.data) || [];

const fetchMore = debounce(() => {
if (query.isFetchingNextPage) return;
// Only fetch more if we have more to fetch and we're not already fetching
if (!query.hasNextPage || query.isFetchingNextPage) return;

query.fetchNextPage();
}, 100);

Expand Down

0 comments on commit c13ca38

Please sign in to comment.