-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(core): update hook return types #6952
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(core): update hook return types #6952
Conversation
|
…in import transformations
…-hook-return-types
…rn-types feat(docs): update docs of hook return types
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
In Refine v4, hooks return flattened objects where query metadata (loading states, errors, etc.) and result data are mixed at the same level:
Query Hooks (useList, useMany, useOne, useCustom, useInfiniteList):
Mutation Hooks (useCreate, useUpdate, useDelete, etc.):
Table Hooks:
What is the new behavior?
In Refine v5, hooks return structured objects that separate query metadata from result data for better type safety and cleaner APIs:
Query Hooks now return
query
andresult
properties:Mutation Hooks now return
mutation
,mutate
, andmutateAsync
properties:Table Hooks include structured return types:
Key improvements:
Migration Support:
fixes: Part of Refine 5.0 major version upgrade
Notes for reviewers
🚨 Breaking Changes
This is a major breaking change that fundamentally restructures how Refine hooks return data. Every consumer of these hooks will need to update their destructuring patterns.
🔍 Review Focus Areas
query
/result
separation in query hooks andmutation
/mutate
/mutateAsync
in mutation hooks