Motivation Behind the Release
Refine v5 removes deprecated APIs and legacy systems, upgrades to TanStack Query v5, and adds React 19 support. The result is a cleaner, faster codebase with better developer experience.Migration Overview
Step 1: Upgrade All Refine Dependencies to v5
Package Version Changes
All Refine packages have been bumped to the next major version as a coordinated release. This ensures maximum stability and compatibility when using packages together.| Package | v4 Version | v5 Version |
|---|---|---|
@refinedev/core | 4.x.x | 5.x.x |
react | 17 or 18 | 18 or 19 |
@tanstack/react-query | 4.x.x | 5.x.x |
@refinedev/antd | 5.x.x | 6.x.x |
@refinedev/mui | 6.x.x | 7.x.x |
@refinedev/mantine | 2.x.x | 3.x.x |
@refinedev/chakra-ui | 2.x.x | 3.x.x |
@refinedev/react-hook-form | 4.x.x | 5.x.x |
@refinedev/react-table | 5.x.x | 6.x.x |
@refinedev/react-router | 1.x.x | 2.x.x |
@refinedev/nextjs-router | 6.x.x | 7.x.x |
@refinedev/remix-router | 3.x.x | 4.x.x |
@refinedev/inferencer | 5.x.x | 6.x.x |
@refinedev/devtools | 1.x.x | 2.x.x |
Update with Refine CLI
You can easily update Refine packages with the Refine CLIupdate command:
Manual Update
Core packages (required):Step 2: Remove All Deprecated APIs from Refine v4
All deprecated APIs marked for removal in v4 have been completely removed in v5.Using Refine Codemod (Recommended)
The@refinedev/codemod package handles the breaking changes for your project and automatically migrates it from 4.x.x to 5.x.x.
Simply cd into the root folder of your project (where the package.json is located) and run this command:
Hook Return Type Changes: The codemod updates most standard cases, but may miss complex destructuring, conditional logic, or custom wrappers. Please review the Data & Mutation Hooks section if you use these patterns.
Changes Not Handled by the Codemod
Unfortunately, the codemod cannot cover every case. Below are changes that require manual updates:useNavigation → useGo
The return values fromuseNavigation have been removed. You should now use useGo for navigation:
goBack), use your router’s native API instead:
ITreeMenu → TreeMenuItem & list field changes
ITreeMenuhas been removed → useTreeMenuIteminsteadlistis now always a string routelist.pathis gone andlistis no longer a function
<Refine /> resource as list. This is no longer supported. Routes/components must be defined in your router.
Step 3: Update Router Provider
If your project is still using thelegacyRouterProvider, you’ll need to migrate to the new router system. The new router provider offers greater flexibility and better integration with modern routing patterns.
Step 4: Update Auth Provider
If your project is still using the legacy auth providerlegacyAuthProvider or auth hooks with v3LegacyAuthProviderCompatible: true, you must migrate to the modern auth provider structure.
Step 5: Upgrade TanStack Query to v5
You’ll need to upgrade TanStack Query from v4 to v5. Please refer to the TanStack Query migration guide for detailed instructions on this upgrade.Step 6: Upgrade React to v19 (Optional)
Refine v5 supports both React 18 and React 19. If you want to take advantage of the latest React features, you can optionally upgrade to React 19. Please refer to the React 19 release notes for more information.Data & Mutation Hooks: Return Type Changes
Return types of data and mutation hooks were refactored for clarity and consistency:- Query state (
isLoading,isError,error, etc.) is now grouped underqueryobject - Mutation state (
isPending,isError,error, etc.) is now grouped undermutationobject - Normalized values (
data,total, etc.) are returned under aresultobject
- Unifies the shape of return types across all hooks
- Eliminates nested property access (e.g.,
data?.data) - Improves type safety and developer experience
- Groups all TanStack Query APIs under the
queryobject for easier discovery
useList
useOne, useMany, useShow
useInfiniteList
Mutation Hooks
List of All Breaking Changes
metaData → meta
metaData → meta
The
metaData parameter has been renamed to meta across all hooks:AuthBindings → AuthProvider (Type Imports)
AuthBindings → AuthProvider (Type Imports)
Type interfaces have been renamed in @refinedev/core:
RouterBindings → RouterProvider (Type Imports)
RouterBindings → RouterProvider (Type Imports)
Type interfaces have been renamed in @refinedev/core:
sorter/sort → sorters
sorter/sort → sorters
The
sorter and sort parameters have been renamed to sorters:filters Updates
filters Updates
Filter configuration has been simplified:
pagination Updates
pagination Updates
Pagination configuration has been restructured:
pagination.current → pagination.currentPage
pagination.current → pagination.currentPage
setCurrent → setCurrentPage
setCurrent → setCurrentPage
Resource options → meta
Resource options → meta
resourceName/resourceNameOrRouteName → resource
resourceName/resourceNameOrRouteName → resource
queryResult → query
queryResult → query
tableQueryResult → tableQuery
tableQueryResult → tableQuery
mutationResult → mutation
mutationResult → mutation
useResource → useResourceParams
useResource → useResourceParams
The
useResource hook has been removed in favor of useResourceParams:ignoreAccessControlProvider → accessControl
ignoreAccessControlProvider → accessControl
ThemedLayoutV2 → ThemedLayout
ThemedLayoutV2 → ThemedLayout
The V2 layout components have been renamed to remove the V2 suffix:
ThemedLayoutV2→ThemedLayoutThemedTitleV2→ThemedTitleThemedSiderV2→ThemedSiderThemedHeaderV2→ThemedHeader
DataProvider getList and custom Method Updates
DataProvider getList and custom Method Updates
useImport and useExport Hook Updates
useImport and useExport Hook Updates
queryKeys → keys
queryKeys → keys