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

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

Closed
alicanerdurmaz opened this issue Jun 28, 2024 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request to be continued

Comments

@alicanerdurmaz
Copy link
Member

alicanerdurmaz commented Jun 28, 2024

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 alicanerdurmaz added the enhancement New feature or request label Jun 28, 2024
@alicanerdurmaz alicanerdurmaz self-assigned this Jun 28, 2024
@alicanerdurmaz alicanerdurmaz linked a pull request Jun 28, 2024 that will close this issue
5 tasks
@alicanerdurmaz
Copy link
Member Author

After discussing this with the core team, we decided to implement it with Refine@5 because the syncWithLocation feature will cause a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request to be continued
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant