refine icon indicating copy to clipboard operation
refine copied to clipboard

[FEAT] `useTable`'s state names `current` and `setCurrent` are confusing.

Open alicanerdurmaz opened this issue 1 year ago • 0 comments

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

  1. current and setCurrent should be deprecated.
  2. useTable should return page and setPage, serving the same purpose.
  3. pagination.page should be added to useTable props, and if pagination.page is provided, it should override pagination.current.
  4. Both current and page should be sent to dataProvider to prevent breaking changes.
  5. syncWithLocation should work with both fields without breaking changes.
  6. useParsed should work with both fields without breaking changes.
const { current, setCurrent, pageSize, setPageSize, pageCount } = useTable({
  pagination: {
    page: 5,
    current: 5,
  },
});

alicanerdurmaz avatar Jun 28 '24 12:06 alicanerdurmaz