refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
25.92k stars 1.96k forks source link

feat: add `result` field to useTable return type #6080

Closed alicanerdurmaz closed 4 days ago

alicanerdurmaz commented 5 days ago

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

When we want to get data returned from useTable, we need to access it like this:

const { tableQueryResult } = useTable() 
const products = tableQueryResult?.data?.data || []

This looks bad.

What is the new behavior?

result field is added to the return value of useTable, useSimpleList, and useDataGrid. It has the same value as tableQueryResult.data.

const { result } = useTable();

const data = result?.data; // identical to tableQueryResult.data.data
const total = result?.total; // identical to tableQueryResult.data.total

Notes for reviewers

changeset-bot[bot] commented 5 days ago

🦋 Changeset detected

Latest commit: b8ce6118e87ff7fa4bfd697f45b992b4e9471317

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages | Name | Type | | ---------------------- | ----- | | @refinedev/react-table | Patch | | @refinedev/antd | Patch | | @refinedev/core | Patch | | @refinedev/mui | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

cypress[bot] commented 5 days ago

Passing run #11244 ↗︎

0 381 37 0 Flakiness 0

Details:

Merge b8ce6118e87ff7fa4bfd697f45b992b4e9471317 into 4265ae2509f79af9dbca8d52daf5...
Project: refine Commit: 6322fbef5b ℹ️
Status: Passed Duration: 21:51 💡
Started: Jun 26, 2024 12:56 PM Ended: Jun 26, 2024 1:18 PM

Review all test suite changes for PR #6080 ↗︎