Skip to content

Commit 512cf15

Browse files
authored
fix: make operations page_size to 20 (#2498)
1 parent 5ff0120 commit 512cf15

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/containers/Operations/useOperationsInfiniteQuery.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22

33
import {throttle} from 'lodash';
44

5-
import {operationsApi} from '../../store/reducers/operations';
5+
import {DEFAULT_PAGE_SIZE, operationsApi} from '../../store/reducers/operations';
66
import type {OperationKind} from '../../types/api/operations';
77

88
interface UseOperationsInfiniteQueryProps {
@@ -18,7 +18,7 @@ const DEFAULT_SCROLL_MARGIN = 100;
1818
export function useOperationsInfiniteQuery({
1919
database,
2020
kind,
21-
pageSize = 10,
21+
pageSize = DEFAULT_PAGE_SIZE,
2222
searchValue,
2323
scrollContainerRef,
2424
}: UseOperationsInfiniteQueryProps) {
@@ -63,8 +63,14 @@ export function useOperationsInfiniteQuery({
6363
// Check after data updates
6464
React.useLayoutEffect(() => {
6565
if (!isFetchingNextPage) {
66-
checkAndLoadMorePages();
66+
// RAF to ensure browser has completed layout and paint
67+
const raf = requestAnimationFrame(() => {
68+
checkAndLoadMorePages();
69+
});
70+
return () => cancelAnimationFrame(raf);
6771
}
72+
73+
return undefined;
6874
}, [data, isFetchingNextPage, checkAndLoadMorePages]);
6975

7076
// Scroll handler for infinite scrolling

src/store/reducers/operations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88

99
import {api} from './api';
1010

11-
const DEFAULT_PAGE_SIZE = 20;
11+
export const DEFAULT_PAGE_SIZE = 20;
1212

1313
// Validate and normalize the response to ensure it has proper structure
1414
function validateOperationListResponse(data: TOperationList): TOperationList {

0 commit comments

Comments
 (0)