Skip to content

Commit

Permalink
fix(react-grid): correctly calculate force reload interval when total…
Browse files Browse the repository at this point in the history
… count is 0 (#2238)
  • Loading branch information
ushkal committed Aug 15, 2019
1 parent 25c8515 commit e9daa64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -393,6 +393,14 @@ describe('VirtualTableState helpers', () => {
end: 400,
});
});

it('should return 2 pages if current total count is 0', () => {
const virtualRows = createVirtualRows(createInterval(0, 0));
expect(getForceReloadInterval(virtualRows, 100, 0)).toEqual({
start: 0,
end: 200,
});
});
});

describe('#needFetchMorePages', () => {
Expand Down
Expand Up @@ -111,7 +111,7 @@ export const getForceReloadInterval: PureComputed<[VirtualRows, number, number],
const { start, end: intervalEnd } = intervalUtil.getRowsInterval(virtualRows);
const end = Math.min(
Math.max(start + pageSize * 2, intervalEnd),
totalRowCount,
Math.max(start + pageSize * 2, totalRowCount),
);
return {
start,
Expand Down

0 comments on commit e9daa64

Please sign in to comment.