Skip to content

Commit

Permalink
(fix) O3-3709 - fix useOpenmrsFetchAll not fetches more than 2 pages (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chibongho authored Sep 23, 2024
1 parent 35baf04 commit f76380b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ describe('useOpenmrsFetchAll', () => {
});

it('should render all rows on if number of rows > pageSize with no partialData', async () => {
const expectedRowCount = 75;
const expectedRowCount = 150;
const { result } = renderHook(() =>
useOpenmrsFetchAll(`http://localhost/2`, {
fetcher: (url) => getTestData(url, expectedRowCount).then((data) => ({ data }) as any),
}),
);
await waitFor(() => expect(result.current.isLoading).toBeFalsy());
expect(result.current.totalCount).toEqual(expectedRowCount);
expect(result.current.data).toEqual(getIntArray(0, 75));
expect(result.current.data).toEqual(getIntArray(0, expectedRowCount));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function useServerFetchAll<T, R>(
if (hasMore && !error) {
loadMore();
}
}, [hasMore]);
}, [hasMore, data]);

if (options.partialData) {
return response;
Expand Down

0 comments on commit f76380b

Please sign in to comment.