Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-grid): correctly calculate force reload interval when total count is 0 #2238

Merged
merged 2 commits into from Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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