refine
refine copied to clipboard
[FEAT] `useTable`'s state names `current` and `setCurrent` are confusing.
Is your feature request related to a problem? Please describe.
The return values of useTable related to pagination are as follows:
import {
useTable
} from "@refinedev/core";
const { current, setCurrent, pageSize, setPageSize, pageCount } = useTable();
The purpose of current and setCurrent is to change the page, but it is unclear what current refers to.
Describe alternatives you've considered
No response
Additional context
No response
Describe the thing to improve
currentandsetCurrentshould be deprecated.useTableshould returnpageandsetPage, serving the same purpose.pagination.pageshould be added touseTableprops, and ifpagination.pageis provided, it should overridepagination.current.- Both
currentandpageshould be sent todataProviderto prevent breaking changes. syncWithLocationshould work with both fields without breaking changes.useParsedshould work with both fields without breaking changes.
const { current, setCurrent, pageSize, setPageSize, pageCount } = useTable({
pagination: {
page: 5,
current: 5,
},
});