Revert "fix: The current change of pagination triggers onChange (#33411)" (#33489)

This reverts commit 629caccaae.
This commit is contained in:
afc163 2021-12-30 15:15:00 +08:00 committed by GitHub
parent 150bd23d53
commit 9ec2709b16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 27 deletions

View File

@ -553,30 +553,4 @@ describe('Table.pagination', () => {
'ant-pagination ant-table-pagination ant-table-pagination-right pagination',
);
});
// https://github.com/ant-design/ant-design/issues/33374
// https://codesandbox.io/s/festive-edison-6uq3e?file=/src/App.js
it('should called onChange when page number is changed by change of total ', () => {
const onChange = jest.fn();
const wrapper = mount(
createTable({
pagination: {
current: 2,
pageSize: 3,
total: 4,
onChange,
},
}),
);
wrapper.setProps({
dataSource: data.slice(0, 3),
pagination: {
current: 2,
pageSize: 3,
total: 3,
onChange,
},
});
expect(onChange).toHaveBeenCalledWith(1, 3);
});
});

View File

@ -73,7 +73,6 @@ export default function usePagination(
if (mergedPagination.current! > maxPage) {
// Prevent a maximum page count of 0
mergedPagination.current = maxPage || 1;
mergedPagination.onChange?.(mergedPagination.current, mergedPagination?.pageSize!);
}
const refreshPagination = (current?: number, pageSize?: number) => {