Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@pankod/refine-core

refinedev7.9kMITdeprecated3.103.0TypeScript support: included

refine v4 is released 🎉 The new version is 100% backward compatible. You can upgrade to v4 with a single command! See the migration guide here: https://refine.dev/docs/migration-guide/3x-to-4x

refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.

readme



Build your React-based CRUD applications, without constraints.
An open source, headless web application framework developed with flexibility in mind.

Discord Twitter Follow

refine - 100% open source React framework to build web apps 3x faster | Product Hunt

Awesome Maintainability Test Coverage npm version npm Contributor Covenant


<picture> <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/18739364/200257042-3f2aa7f7-a07f-4824-8d2a-b25f26b6fd32.png"> how-works-refine </picture>

What is refine?

refine is a React-based framework for the rapid ✨ development of web applications. It eliminates repetitive tasks demanded by CRUD operations and provides industry standard solutions for critical parts like authentication, access control, routing, networking, state management, and i18n.

refine is headless by design, thereby offering unlimited styling and customization options.

What do you mean by "headless" ?

Instead of being a limited set of pre-styled components, refine is a collection of helper hooks, components, and providers. They are all decoupled from UI components and business logic, so that they never keep you from customizing your UI or coding your own flow.

refine seamlessly works with any custom design or UI framework that you favor. For convenience, it ships with ready-made integrations for Ant Design System, Material UI, Mantine, and Chakra UI.

Use cases

refine shines on data-intensive⚡ applications like admin panels, dashboards and internal tools. Thanks to the built-in SSR support, refine can also power customer-facing applications like storefronts.

You can take a look at some live examples that can be built using refine from scratch:



👉 Refer to most popular real use case examples

👉 More refine powered different usage scenarios can be found here

Key Features

⚙️ Zero-config, one-minute setup with a single CLI command

🔌 Connectors for 15+ backend services including REST API, GraphQL, NestJs CRUD, Airtable, Strapi, Strapi v4, Strapi GraphQL, Supabase, Hasura, Appwrite, Firebase, and Directus.

🌐 SSR support with Next.js or Remix

🔍 Auto-generated CRUD UIs from your API data structure

⚛ Perfect state management & mutations with React Query

🔀 Advanced routing with any router library of your choice

🔐 Providers for seamless authentication and access control flows

⚡ Out-of-the-box support for live / real-time applications

📄 Easy audit logs & document versioning

💬 Support for any i18n framework

💪 Future-proof, robust architecture

⌛️ Built-in CLI with time-saving features

✅ Full test coverage

Quick Start

The fastest way to get started with refine is by using the create refine-app project starter tool. Run the following command to create a new refine project configured with Ant Design System as the default UI framework:

npm create refine-app@latest -- --preset refine-antd

Once the setup is complete, navigate to the project folder and start your project with:

npm run dev

Your refine application will be accessible at http://localhost:3000:

Welcome on board


Let's consume a public fake REST API and add two resources (posts, categories) to our project. Replace the contents of src/App.tsx with the following code:

`tsx title="src/App.tsx" import { Refine } from "@pankod/refine-core"; import { Layout, ReadyPage, notificationProvider, ErrorComponent, } from "@pankod/refine-antd"; import routerProvider from "@pankod/refine-react-router-v6"; import dataProvider from "@pankod/refine-simple-rest";

import { AntdInferencer } from "@pankod/refine-inferencer/antd";

import "@pankod/refine-antd/dist/reset.css";

const App: React.FC = () => { return ( <Refine routerProvider={routerProvider} dataProvider={dataProvider("https://api.fake-rest.refine.dev")} Layout={Layout} ReadyPage={ReadyPage} notificationProvider={notificationProvider} catchAll={<ErrorComponent />} resources={[ { name: "posts", list: AntdInferencer, show: AntdInferencer, create: AntdInferencer, edit: AntdInferencer, canDelete: true, }, { name: "categories", list: AntdInferencer, show: AntdInferencer, }, ]} /> ); };

export default App; `


🚀 Thanks to refine Inferencer package, it guesses the configuration to use for the list, show, create, and edit pages based on the data fetched from the API and generates the pages automatically.

Now, you should see the output as a table populated with post & category data:

First example result


You can get the auto-generated pages codes by clicking the Show Code button on each page. Afterward, simply pass the pages to the resources array by replacing with the Inferencer components.

Next Steps

👉 Jump to Tutorial to continue your work and turn the example into a full-blown CRUD application.

👉 Visit Learn the Basics Page to get informed about the fundamental concepts.

👉 Read more on Advanced Tutorials for different usage scenarios.

👉 See the real-life Finefoods Demo project.

👉 Play with interactive Examples

Roadmap

You can find refine's Public Roadmap here!

Stargazers

Stargazers repo roster for refinedev/refine

Contribution

👉 Refer to contribution docs for more information

If you have any doubts related to the project or want to discuss something, then join our Discord Server.

Our ♥️ Contributors

License

Licensed under the MIT License, Copyright © 2021-present Refinedev

changelog

@pankod/refine-core

3.103.0

Minor Changes

3.102.0

Minor Changes

3.101.2

Patch Changes

3.101.1

Patch Changes

3.101.0

Minor Changes

3.100.0

Minor Changes

3.99.6

Patch Changes

  • #3657 5868456194f Thanks @fuunnx! - Fix optimistic updates of list's query data following a mutation using useUpdate

3.99.5

Patch Changes

  • #3657 5868456194f Thanks @fuunnx! - Fix optimistic updates of list's query data following a mutation using useUpdate

3.99.4

Patch Changes

3.99.3

Patch Changes

3.99.2

Patch Changes

3.99.1

Patch Changes

3.99.0

Minor Changes

3.98.0

Minor Changes

3.97.0

Minor Changes

  • #3442 8f2954611fa Thanks @salihozdemir! - Added swizzle support for @pankod/refine-core package.

    Swizzleable components:

    • Authenticated
    • CanAccess
    • ErrorPage
    • Authentication Pages
      • Login
      • Logout
      • Register
      • ForgotPassword
      • UpdatePassword

Patch Changes

3.96.0

Minor Changes

  • #3442 8f2954611fa Thanks @salihozdemir! - Added swizzle support for @pankod/refine-core package.

    Swizzleable components:

    • Authenticated
    • CanAccess
    • ErrorPage
    • Authentication Pages
      • Login
      • Logout
      • Register
      • ForgotPassword
      • UpdatePassword

Patch Changes

3.95.3

Patch Changes

  • #3382 6604586b030 Thanks @alicanerdurmaz! - Fixed: The link in the jsDOC of the liveMode replaced with the correct link.

    - * @type  [`"auto" | "manual" | "off"`](/docs/api-reference/core/interfaceReferences/#crudsorting)
    + * @type  [`"auto" | "manual" | "off"`](/docs/api-reference/core/providers/live-provider/#livemode)

3.95.2

Patch Changes

  • #3382 6604586b030 Thanks @alicanerdurmaz! - Fixed: The link in the jsDOC of the liveMode replaced with the correct link.

    - * @type  [`"auto" | "manual" | "off"`](/docs/api-reference/core/interfaceReferences/#crudsorting)
    + * @type  [`"auto" | "manual" | "off"`](/docs/api-reference/core/providers/live-provider/#livemode)

3.95.1

Patch Changes

3.95.0

Minor Changes

3.94.2

Patch Changes

  • #3364 98a1fbec65a Thanks @aliemir! - Changed IResourceComponents from IResourceContext to use React.ComponentType rather than React.FunctionComponent to make it compatible with other types and interfaces.

  • #3356 310ebd05990 Thanks @omeraplak! - Fixed checkError hook is not called in onError of useCustomMutation

3.94.1

Patch Changes

  • #3364 98a1fbec65a Thanks @aliemir! - Changed IResourceComponents from IResourceContext to use React.ComponentType rather than React.FunctionComponent to make it compatible with other types and interfaces.

  • #3356 310ebd05990 Thanks @omeraplak! - Fixed checkError hook is not called in onError of useCustomMutation

3.94.0

Minor Changes

3.93.0

Minor Changes

3.92.0

Minor Changes

  • #3324 9bfb34749bc Thanks @aliemir! - Added the ability to pass mutation options to useMutation hooks in mutation hooks:
    • useCreate (data)
    • useUpdate (data)
    • useDelete (data)
    • useDeleteMany (data)
    • useUpdateMany (data)
    • useCreateMany (data)
    • useCustomMutation (data)
    • useLogin (auth)
    • useLogout (auth)
    • useRegister (auth)
    • useForgotPassword (auth)
    • useUpdatePassword (auth)
    • useForm (form)

Patch Changes

3.91.0

Minor Changes

  • #3324 9bfb34749bc Thanks @aliemir! - Added the ability to pass mutation options to useMutation hooks in mutation hooks:
    • useCreate (data)
    • useUpdate (data)
    • useDelete (data)
    • useDeleteMany (data)
    • useUpdateMany (data)
    • useCreateMany (data)
    • useCustomMutation (data)
    • useLogin (auth)
    • useLogout (auth)
    • useRegister (auth)
    • useForgotPassword (auth)
    • useUpdatePassword (auth)
    • useForm (form)

Patch Changes

3.90.6

Patch Changes

3.90.5

Patch Changes

3.90.4

Patch Changes

  • #3098 a241ef3c957 Thanks @aliemir! - Update notificationProvider prop handling by converting to a custom hook to prevent hook usage errors.

3.90.3

Patch Changes

  • #3098 a241ef3c957 Thanks @aliemir! - Update notificationProvider prop handling by converting to a custom hook to prevent hook usage errors.

3.90.2

Patch Changes

3.90.1

Patch Changes

3.90.0

Minor Changes

3.89.0

Minor Changes

3.88.4

Patch Changes

3.88.3

Patch Changes

3.88.2

Patch Changes

3.88.1

Patch Changes

3.88.0

Minor Changes

  • #2872 da3fc4a702 Thanks @TDP17! - Feat: Added ability to manage breadcrumb component globally via options

    Usage

    <Refine
        options= {{
            breadcrumb: false, // hide globally
        }}
    />
    or
    ```jsx
    <Refine
        options= {{
            breadcrumb: <MyCustomBreadcrumbComponent /> // custom component
        }}
    />

3.87.0

Minor Changes

  • #2872 da3fc4a702 Thanks @TDP17! - Feat: Added ability to manage breadcrumb component globally via options

    Usage

    <Refine
        options= {{
            breadcrumb: false, // hide globally
        }}
    />
    or
    ```jsx
    <Refine
        options= {{
            breadcrumb: <MyCustomBreadcrumbComponent /> // custom component
        }}
    />

3.86.2

Patch Changes

  • #2839 5388a338ab Thanks @aliemir! - useCan hook was returning the stale value if same call is made with skipped access control.

3.86.1

Patch Changes

  • #2839 5388a338ab Thanks @aliemir! - useCan hook was returning the stale value if same call is made with skipped access control.

3.86.0

Minor Changes

  • Only or was supported as a conditional filter. Now and and or can be used together and nested. 🚀

    {
      operator: "or",
      value: [
        {
          operator: "and",
          value: [
            {
              field: "name",
              operator: "eq",
              value: "John Doe",
            },
            {
              field: "age",
              operator: "eq",
              value: 30,
            },
          ],
        },
        {
          operator: "and",
          value: [
            {
              field: "name",
              operator: "eq",
              value: "JR Doe",
            },
            {
              field: "age",
              operator: "eq",
              value: 1,
            },
          ],
        },
      ],
    }

3.85.0

Minor Changes

  • #2751 addff64c77 Thanks @yildirayunlu! - Only or was supported as a conditional filter. Now and and or can be used together and nested. 🚀

    {
      operator: "or",
      value: [
        {
          operator: "and",
          value: [
            {
              field: "name",
              operator: "eq",
              value: "John Doe",
            },
            {
              field: "age",
              operator: "eq",
              value: 30,
            },
          ],
        },
        {
          operator: "and",
          value: [
            {
              field: "name",
              operator: "eq",
              value: "JR Doe",
            },
            {
              field: "age",
              operator: "eq",
              value: 1,
            },
          ],
        },
      ],
    }

3.84.0

Minor Changes

  • Marked getMany, createMany, updateMany and deleteMany functions as optional and substituted with getOne, create, update and deleteOne respectively. Now users can choose to skip implementing getMany, createMany, updateMany and deleteMany functions and use getOne, create, update and deleteOne functions instead.

    Breaking Change

    • getMany, createMany, updateMany and deleteMany functions are now optional and may cause type issues if used outside of the refine hooks.

3.83.0

Minor Changes

  • #2688 508045ac30 Thanks @aliemir! - Marked getMany, createMany, updateMany and deleteMany functions as optional and substituted with getOne, create, update and deleteOne respectively. Now users can choose to skip implementing getMany, createMany, updateMany and deleteMany functions and use getOne, create, update and deleteOne functions instead.

    Breaking Change

    • getMany, createMany, updateMany and deleteMany functions are now optional and may cause type issues if used outside of the refine hooks.

3.82.0

Minor Changes

  • Added useSelect(), setState handler functions are memoized

    Fixed when queryOptions.enabled = true on useSelect(), fetches all data. #2691

Patch Changes

  • fix: useSelect()'s overridden onSearch function is not calling when value is empty.

3.81.0

Minor Changes

  • #2704 e4d78052ef Thanks @alicanerdurmaz! - Added useSelect(), setState handler functions are memoized

    Fixed when queryOptions.enabled = true on useSelect(), fetches all data. #2691

Patch Changes

3.80.0

Minor Changes

  • Added infinite loading example to antd useSelect() useSelect() fetchSize prop is deprecated. From now pagination should be used

  • Added dataProviderName property to resource options. Now you can define default data provider per resource.

    Usage

    <Refine
        dataProvider={{
            default: myProvider,
            second: mySecondProvider,
        }}
        resources={[
            {
                name: "posts",
                options: {
                    dataProviderName: "second",
                },
            },
        ]}
    />

Patch Changes

  • Add AuthProps type export

  • Mark default key as required for multiple data providers in dataProvider prop of <Refine /> component.

3.79.0

Minor Changes

  • #2629 bc89228e73 Thanks @bungambohlah! - Added infinite loading example to antd useSelect() useSelect() fetchSize prop is deprecated. From now pagination should be used

  • #2674 3bd6196056 Thanks @aliemir! - Added dataProviderName property to resource options. Now you can define default data provider per resource.

    Usage

    <Refine
        dataProvider={{
            default: myProvider,
            second: mySecondProvider,
        }}
        resources={[
            {
                name: "posts",
                options: {
                    dataProviderName: "second",
                },
            },
        ]}
    />

Patch Changes

3.78.0

Minor Changes

  • clientConfig property now accepts QueryClient instance - #2665

    Usage

    import { QueryClient } from "@tanstack/react-query";
    const queryClient = new QueryClient();
    const App: React.FC = () => (
        <Refine
            ...
            options={{
                reactQuery: {
                    clientConfig: queryClient
                },
            }}
        />
    );

3.77.0

Minor Changes

  • #2670 f260932051 Thanks @alicanerdurmaz! - clientConfig property now accepts QueryClient instance - #2665

    Usage

    import { QueryClient } from "@tanstack/react-query";
    const queryClient = new QueryClient();
    const App: React.FC = () => (
        <Refine
            ...
            options={{
                reactQuery: {
                    clientConfig: queryClient
                },
            }}
        />
    );

3.76.0

Minor Changes

    • Added new <AuthPage /> component core and mantine support.
    • Move Auth types @pankod/refine-ui-types to @pankod/refine-core

Patch Changes

  • fix core data hooks type errors

3.75.1

Patch Changes

3.75.0

Minor Changes

  • #2627 c5fb45d61f Thanks @yildirayunlu! - - Added new <AuthPage /> component core and mantine support.
    • Move Auth types @pankod/refine-ui-types to @pankod/refine-core

3.74.8

Patch Changes

  • add props table to useCan documentation

3.74.7

Patch Changes

3.74.6

Patch Changes

  • Updated devtoolConfig type.

3.74.5

Patch Changes

3.74.4

Patch Changes

  • Fixed useMenu hook is not reacting to locale change - #2598

3.74.3

Patch Changes

3.74.2

Patch Changes

  • Removed redundant type inheritance

3.74.1

Patch Changes

3.74.0

Minor Changes

  • Combine action related types into a single file and derive types from it to avoid future inconsistencies.

    Renamed RedirectionTypes type to RedirectAction.

    Updated every type definition of actions to use the new Action type or derivations of it.

Patch Changes

  • Fixed the issue in resource routes not taking options.route of parent resource into account.

  • Rename reset-password -> forgot-password on docs.

3.73.0

Minor Changes

  • Combine action related types into a single file and derive types from it to avoid future inconsistencies.

    Renamed RedirectionTypes type to RedirectAction.

    Updated every type definition of actions to use the new Action type or derivations of it.

Patch Changes

  • Fixed the issue in resource routes not taking options.route of parent resource into account.

  • Rename reset-password -> forgot-password on docs.

3.72.1

Patch Changes

3.72.0

Minor Changes

  • #2486 ee4d0d112a Thanks @aliemir! - Combine action related types into a single file and derive types from it to avoid future inconsistencies.

    Renamed RedirectionTypes type to RedirectAction.

    Updated every type definition of actions to use the new Action type or derivations of it.

Patch Changes

  • #2486 ee4d0d112a Thanks @aliemir! - Fixed the issue in resource routes not taking options.route of parent resource into account.

3.71.2

Patch Changes

  • Fix useImport hook requests with properly invoking requests sequentially and manage progress state.

  • Removed children property from useCans params.resource since it can be in ITreeMenu type and React.ReactNode breaks the react-querys key stringify function.

  • Fixed undoable mutation is called many times - #2556

3.71.1

Patch Changes

  • #2560 373cee23ba Thanks @aliemir! - Fix useImport hook requests with properly invoking requests sequentially and manage progress state.

  • #2537 4407bf8825 Thanks @ozkalai! - Removed children property from useCans params.resource since it can be in ITreeMenu type and React.ReactNode breaks the react-querys key stringify function.

  • #2559 75b699cd6c Thanks @omeraplak! - Fixed undoable mutation is called many times - #2556

3.71.0

Minor Changes

    • Renamed resetPassword in AuthProvider to forgotPassword
    • Renamed useResetPassword hook to useForgotPassword

3.70.0

Minor Changes

  • #2524 27bf81bebb Thanks @biskuvit! - - Renamed resetPassword in AuthProvider to forgotPassword
    • Renamed useResetPassword hook to useForgotPassword

3.69.9

Patch Changes

  • Add register function to AuthContextProvider for invalidate auth store queries.

  • Fixed version of react-router to 6.3.0

3.69.8

Patch Changes

3.69.7

Patch Changes

3.69.6

Patch Changes

  • Fix import of react-query DevtoolsOptions interface

3.69.5

Patch Changes

3.69.4

Patch Changes

  • Fixed default login page for headless

3.69.3

Patch Changes

3.69.2

Patch Changes

  • Update useForm and useShow hooks to watch for id from props and update the query with the new id when it changes.

3.69.1

Patch Changes

  • #2467 21bb649bc7 Thanks @aliemir! - Update useForm and useShow hooks to watch for id from props and update the query with the new id when it changes.

3.69.0

Minor Changes

  • Adding more CRUD Filter Operators

  • Add initialData support to DashboardPage for @pankod/refine-nextjs-router.

3.68.0

Minor Changes

3.67.0

Minor Changes

  • Updated the generation of type declarations, moved the declarations from tsup to tsc for a better experience with Peek Definition and Go to Definition features. After this change, it's expected to navigate to the source code of the refine packages instead of the dist directory with combined declarations.

  • Removed jose dependency.

  • Remove decamelize dependency from humanizeString helper and replace the functionality with regExp.

Patch Changes

  • Fixed the issue with the TS compiler and useResource hooks return type.

  • Pass dataProviderName prop to mutations in @pankod/refine-core's useImport hook.

3.66.1

Patch Changes

  • #2448 f1edb19979 Thanks @aliemir! - Pass dataProviderName prop to mutations in @pankod/refine-core's useImport hook.

3.66.0

Minor Changes

  • #2440 0150dcd070 Thanks @aliemir! - Updated the generation of type declarations, moved the declarations from tsup to tsc for a better experience with Peek Definition and Go to Definition features. After this change, it's expected to navigate to the source code of the refine packages instead of the dist directory with combined declarations.

  • #2439 f2faf99f25 Thanks @yildirayunlu! - Removed jose dependency.

  • #2443 2c428b3105 Thanks @ozkalai! - Remove decamelize dependency from humanizeString helper and replace the functionality with regExp.

Patch Changes

3.65.3

Patch Changes

  • Fixed, loginLink and registerLink texts and remove unnecessary props from forms

  • Fixed syncWithLocation not tracking when useTable filters were reset

3.65.2

Patch Changes

3.65.1

Patch Changes

3.65.0

Minor Changes

  • 🎉 Added AuthPage component to the refine app. This page is used to login, register, forgot password and update password. Login page is default page and old LoginPage component is deprecated.

    New Auth Hooks

    📌 Added useRegister hook. This hook is used to register new user. useRegister falls into register function of AuthProvider.

    📌 Added useForgotPassword hook. This hook is used to forgot password. useForgotPassword falls into forgotPassword function of AuthProvider.

    📌 Added useUpdatePassword hook. This hook is used to update password. useUpdatePassword falls into updatePassword function of AuthProvider.

    - <LoginPage>
    + <AuthPage>

    New AuthPage props:

    interface IAuthPageProps extends IAuthCommonProps {
        type?: "login" | "register" | "forgotPassword" | "updatePassword";
    }
    
    interface IAuthCommonProps {
        submitButton?: React.ReactNode;
        registerLink?: React.ReactNode;
        loginLink?: React.ReactNode;
        forgotPasswordLink?: React.ReactNode;
        updatePasswordLink?: React.ReactNode;
        backLink?: React.ReactNode;
        providers?: IProvider[];
    }
    
    interface IProvider {
        name: string;
        icon?: React.ReactNode;
        label?: string;
    }

Patch Changes

  • Fixed <AuthPage> by adding missing props to "login" and "register" pages.

    Fixed <Refine> component LoginPage property.

3.64.2

Patch Changes

  • #2415 f7c98f0ef9 Thanks @biskuvit! - Fixed <AuthPage> by adding missing props to "login" and "register" pages.

    Fixed <Refine> component LoginPage property.

3.64.1

Patch Changes

  • #2299 a02cb9e8ef Thanks @biskuvit! - 🎉 Added AuthPage to the refine app. This page is used to login, register, forgot password and update password. Login page is default page and old LoginPage component is deprecated.

    New Auth Hooks

    📌 Added useRegister hook. This hook is used to register new user. useRegister falls into register function of AuthProvider.

    📌 Added useForgotPassword hook. This hook is used to forgot password. useForgotPassword falls into forgotPassword function of AuthProvider.

    📌 Added useUpdatePassword hook. This hook is used to update password. useUpdatePassword falls into updatePassword function of AuthProvider.

    - <LoginPage>
    + <AuthPage>

    New AuthPage props:

    interface IAuthPageProps extends IAuthCommonProps {
        type?: "login" | "register" | "forgotPassword" | "updatePassword";
    }
    
    interface IAuthCommonProps {
        registerLink?: React.ReactNode;
        loginLink?: React.ReactNode;
        forgotPasswordLink?: React.ReactNode;
        updatePasswordLink?: React.ReactNode;
        backLink?: React.ReactNode;
        providers?: IProvider[];
    }
    
    interface IProvider {
        name: string;
        icon?: React.ReactNode;
        label?: string;
    }

    Add AuthPage as a default page to Routers

    📌 Added AuthPage to the refine-nextjs-router. Default page is AuthPage.

    📌 Added AuthPage to the refine-react-location. Default page is AuthPage.

    📌 Added AuthPage to the refine-react-router-v6. Default page is AuthPage.

    📌 Added AuthPage to the refine-remix-router. Default page is AuthPage.

3.64.0

Minor Changes

  • Add an option to hide resources from the Sider menu

    <Refine
        ...
        ...
        resources={[
            {
                name: "posts",
                list: PostList,
                options: {
                    hide: true,
                },
            },
        ]}
    />
  • Add object path syntax support for the useSelect hook

    useSelect({
        resource: "posts",
        optionLabel: "nested.title",
        optionLabel: "nested.id",
    });

3.63.0

Minor Changes

  • #2391 e530670c2d Thanks @omeraplak! - Add an option to hide resources from the Sider menu

    <Refine
        ...
        ...
        resources={[
            {
                name: "posts",
                list: PostList,
                options: {
                    hide: true,
                },
            },
        ]}
    />
  • #2395 3019fae7a0 Thanks @omeraplak! - Add object path syntax support for the useSelect hook

    useSelect({
        resource: "posts",
        optionLabel: "nested.title",
        optionLabel: "nested.id",
    });

3.62.1

Patch Changes

  • fix redirectPage return value #2377

3.62.0

Minor Changes

  • Added a new <Refine> component property: options.

    Previously, the options were passed as a property to the <Refine> component. Now, the options are passed to the <Refine> via options property like this:

        <Refine
    -       mutationMode="undoable"
    -       undoableTimeout={5000}
    -       warnWhenUnsavedChanges
    -       syncWithLocation
    -       liveMode="off"
    -       disableTelemetry={false}
    +       options={{
    +           mutationMode: "undoable",
    +           undoableTimeout: 5000,
    +           warnWhenUnsavedChanges: true,
    +           syncWithLocation: true,
    +           liveMode: "off",
    +           disableTelemetry: false,
    +       }}
        />
  • Added a new redirect feature. It is now possible to set default redirects.

    By default, when a form is submitted, it will redirect to the "list" page of the current resource. You can change this behavior by setting the redirect parameter like this:

    <Refine
        ...
        options={{ redirect: { afterCreate: "show", afterClone: "edit", afterEdit: false }, }}
    />

Patch Changes

    • lodash moved to "dependencies" for CommonJS builds
    • Fixed lodash-es usage for ESM builds

3.61.1

Patch Changes

3.61.0

Minor Changes

  • Added a new <Refine> component property: options.

    Previously, the options were passed as a property to the <Refine> component. Now, the options are passed to the <Refine> via options property like this:

        <Refine
    -       mutationMode="undoable"
    -       undoableTimeout={5000}
    -       warnWhenUnsavedChanges
    -       syncWithLocation
    -       liveMode="off"
    -       disableTelemetry={false}
    +       options={{
    +           mutationMode: "undoable",
    +           undoableTimeout: 5000,
    +           warnWhenUnsavedChanges: true,
    +           syncWithLocation: true,
    +           liveMode: "off",
    +           disableTelemetry: false,
    +       }}
        />
  • Added a new redirect feature. It is now possible to set default redirects.

    By default, when a form is submitted, it will redirect to the "list" page of the current resource. You can change this behavior by setting the redirect parameter like this:

    <Refine
        ...
        options={{ redirect: { afterCreate: "show", afterClone: "edit", afterEdit: false }, }}
    />

Patch Changes

    • lodash moved to "dependencies" for CommonJS builds
    • Fixed lodash-es usage for ESM builds

3.60.0

Minor Changes

  • Added a new <Refine> component property: options.

    Previously, the options were passed as a property to the <Refine> component. Now, the options are passed to the <Refine> via options property like this:

        <Refine
    -       mutationMode="undoable"
    -       undoableTimeout={5000}
    -       warnWhenUnsavedChanges
    -       syncWithLocation
    -       liveMode="off"
    -       disableTelemetry={false}
    +       options={{
    +           mutationMode: "undoable",
    +           undoableTimeout: 5000,
    +           warnWhenUnsavedChanges: true,
    +           syncWithLocation: true,
    +           liveMode: "off",
    +           disableTelemetry: false,
    +       }}
        />
  • Added a new redirect feature. It is now possible to set default redirects.

    By default, when a form is submitted, it will redirect to the "list" page of the current resource. You can change this behavior by setting the redirect parameter like this:

    <Refine
        ...
        options={{ redirect: { afterCreate: "show", afterClone: "edit", afterEdit: false }, }}
    />

Patch Changes

    • lodash moved to "dependencies" for CommonJS builds
    • Fixed lodash-es usage for ESM builds

3.59.0

Minor Changes

  • #2352 e4d39eff33 Thanks @salihozdemir! - Added a new <Refine> component property: options.

    Previously, the options were passed as a property to the <Refine> component. Now, the options are passed to the <Refine> via options property like this:

        <Refine
    -       mutationMode="undoable"
    -       undoableTimeout={5000}
    -       warnWhenUnsavedChanges
    -       syncWithLocation
    -       liveMode="off"
    -       disableTelemetry={false}
    +       options={{
    +           mutationMode: "undoable",
    +           undoableTimeout: 5000,
    +           warnWhenUnsavedChanges: true,
    +           syncWithLocation: true,
    +           liveMode: "off",
    +           disableTelemetry: false,
    +       }}
        />
  • #2361 95e1a17cd1 Thanks @salihozdemir! - Added a new redirect feature. It is now possible to set default redirects.

    By default, when a form is submitted, it will redirect to the "list" page of the current resource. You can change this behavior by setting the redirect parameter like this:

    <Refine
        ...
        options={{ redirect: { afterCreate: "show", afterClone: "edit", afterEdit: false }, }}
    />

Patch Changes

3.58.5

Patch Changes

  • lodash moved to dependencies.

3.58.4

Patch Changes

3.58.3

Patch Changes

  • Fixed react-query devtools was consuming high CPU

3.58.2

Patch Changes

3.58.1

Patch Changes

  • AuthProvider's login method can now return a value for Remix's authentication flow

3.58.0

Minor Changes

  • Updated reactQueryDevtoolConfig prop type and added false option to disable the React Query Devtools.

3.57.0

Minor Changes

  • #2311 645391a3d9 Thanks @aliemir! - Updated reactQueryDevtoolConfig prop type and added false option to disable the React Query Devtools.

3.56.11

Patch Changes

  • Fixed user-defined URL query parameters being deleted when using syncWithLocation

3.56.10

Patch Changes

3.56.9

Patch Changes

3.56.8

Patch Changes

  • Fixed @tanstack/react-query-devtools dependency

3.56.7

Patch Changes

3.56.6

Patch Changes

  • Upgraded react-query version to 4.

  • Updated the return value of useGetIdentity. When the getUserIdentity function is not defined, it returns {} instead of undefined.

3.56.5

Patch Changes

3.56.4

Patch Changes

  • Fix useCan hook params keys.

    Since react-query stringifies the query keys, it will throw an error for a circular dependency if we include React.ReactNode elements inside the keys. The feature in #2220(https://github.com/refinedev/refine/issues/2220) includes such change and to fix this, we need to remove icon property in the resource

  • Updated <Refine/> component with memoization to prevent unwanted effects.

    • Fixed the issue: react-query's queryClient was re-initializing on every render which was causing it to reset the query cache.
    • Memoized the notificationProvider prop to prevent unnecessary re-renders.
    • Memoized the resources prop to prevent unnecessary transform calls on every render.
    • Fixed Browser back navigation is broken with syncWithLocation and paginated useTable - #2276
    • Updated push and replace args of useNavigation

3.56.3

Patch Changes

  • #2278 8b11f8a267 Thanks @biskuvit! - Fix useCan hook params keys.

    Since react-query stringifies the query keys, it will throw an error for a circular dependency if we include React.ReactNode elements inside the keys. The feature in #2220(https://github.com/refinedev/refine/issues/2220) includes such change and to fix this, we need to remove icon property in the resource

  • #2280 e22cac6d8b Thanks @aliemir! - Updated <Refine/> component with memoization to prevent unwanted effects.

    • Fixed the issue: react-query's queryClient was re-initializing on every render which was causing it to reset the query cache.
    • Memoized the notificationProvider prop to prevent unnecessary re-renders.
    • Memoized the resources prop to prevent unnecessary transform calls on every render.
  • #2279 786fb08b8b Thanks @omeraplak! - - Fixed Browser back navigation is broken with syncWithLocation and paginated useTable - #2276

    • Updated push and replace args of useNavigation

3.56.2

Patch Changes

  • Fixed invalidation of authentication caches every time checkAuth is run

3.56.1

Patch Changes

3.56.0

Minor Changes

  • Add React@18 support 🚀

3.55.0

Minor Changes

3.54.0

Minor Changes

  • Added config parameter to useCustomMutationHook to send headers.

    const apiUrl = useApiUrl();
    
    const { mutate } = useCustomMutation<ICategory>();
    
    mutate({
        url: `${API_URL}/categories`,
        method: "post",
        values: {
          title: "New Category",
        },
        config: {
          headers: {
              Authorization: "Bearer ****",
          },
        },
    });

3.53.0

Minor Changes

  • #2245 e949df7f1c Thanks @yildirayunlu! - Added config parameter to useCustomMutationHook to send headers.

    const apiUrl = useApiUrl();
    
    const { mutate } = useCustomMutation<ICategory>();
    
    mutate({
        url: `${API_URL}/categories`,
        method: "post",
        values: {
          title: "New Category",
        },
        config: {
          headers: {
              Authorization: "Bearer ****",
          },
        },
    });

3.52.0

Minor Changes

  • Added useCustomMutationhook for custom mutation requests.

    import { useCustomMutation } from "@pankod/refine-core";
    const { mutation } = useCustomMutation();
    
    mutation({
        url: "https://api.example.com/users",
        method: "POST",
        values: {
            name: "John Doe",
            email: "johndoe@mail.com",
        },
    });

3.51.0

Minor Changes

  • #2229 878e9a105e Thanks @yildirayunlu! - Added useCustomMutationhook for custom mutation requests.

    import { useCustomMutation } from "@pankod/refine-core";
    const { mutation } = useCustomMutation();
    
    mutation({
        url: "https://api.example.com/users",
        method: "POST",
        values: {
            name: "John Doe",
            email: "johndoe@mail.com",
        },
    });

3.50.0

Minor Changes

  • Pass the full resource to the accessControlProvider can method. This will enable Attribute Based Access Control (ABAC), for example granting permissions based on the value of a field in the resource object.

    const App: React.FC = () => {
        <Refine
            // other providers and props
            accessControlProvider={{
                can: async ({ resource, action, params }) => {
                    if (resource === "posts" && action === "edit") {
                        return Promise.resolve({
                            can: false,
                            reason: "Unauthorized",
                        });
                    }
    
                    // or you can access directly *resource object
                    // const resourceName = params?.resource?.name;
                    // const anyUsefulOption = params?.resource?.options?.yourUsefulOption;
                    // if (resourceName === "posts" && anyUsefulOption === true && action === "edit") {
                    //     return Promise.resolve({
                    //         can: false,
                    //         reason: "Unauthorized",
                    //     });
                    // }
    
                    return Promise.resolve({ can: true });
                },
            }}
        />;
    };

3.49.0

Minor Changes

  • #2222 43e92b9785 Thanks @omeraplak! - Pass the full resource to the accessControlProvider can method. This will enable Attribute Based Access Control (ABAC), for example granting permissions based on the value of a field in the resource object.

    const App: React.FC = () => {
        <Refine
            // other providers and props
            accessControlProvider={{
                can: async ({ resource, action, params }) => {
                    if (resource === "posts" && action === "edit") {
                        return Promise.resolve({
                            can: false,
                            reason: "Unauthorized",
                        });
                    }
    
                    // or you can access directly *resource object
                    // const resourceName = params?.resource?.name;
                    // const anyUsefulOption = params?.resource?.options?.yourUsefulOption;
                    // if (resourceName === "posts" && anyUsefulOption === true && action === "edit") {
                    //     return Promise.resolve({
                    //         can: false,
                    //         reason: "Unauthorized",
                    //     });
                    // }
    
                    return Promise.resolve({ can: true });
                },
            }}
        />;
    };

3.48.0

Minor Changes

  • All of the refine packages have dependencies on the @pankod/refine-core package. So far we have managed these dependencies with peerDependencies + dependencies but this causes issues like #2183. (having more than one @pankod/refine-core version in node_modules and creating different instances)

    Managing as peerDependencies + devDependencies seems like the best way for now to avoid such issues.

Patch Changes

  • Fix adding the current path to the to parameter when redirecting to the login page after logout - #2211

3.47.0

Minor Changes

  • #2217 b4aae00f77 Thanks @omeraplak! - All of the refine packages have dependencies on the @pankod/refine-core package. So far we have managed these dependencies with peerDependencies + dependencies but this causes issues like #2183. (having more than one @pankod/refine-core version in node_modules and creating different instances)

    Managing as peerDependencies + devDependencies seems like the best way for now to avoid such issues.

3.46.0

Minor Changes

  • Update notification props in data hooks of @pankod/refine-core to cover dynamic notifications.

    Now users will be able to show notifications according to the API response by assigning a function which returns OpenNotificationParams instead of an OpenNotificationParams object.

    Example

    {
        const { mutate } = useCreate({
            /* ... */
            successNotification: (data, values, resource) => ({
                message: data?.message ?? "Success!",
                type: "success",
                description: data?.description;
            }),
            errorNotification: (error, values, resource) => ({
                message: error?.message ?? error?.code ?? "Error!",
                type: "error",
                description: error?.reason;
            })
            /* ... */
        });
    }

3.45.0

Minor Changes

  • #2177 5a805c789a Thanks @aliemir! - Update notification props in data hooks of @pankod/refine-core to cover dynamic notifications.

    Now users will be able to show notifications according to the API response by assigning a function which returns OpenNotificationParams instead of an OpenNotificationParams object.

    Example

    {
        const { mutate } = useCreate({
            /* ... */
            successNotification: (data, values, resource) => ({
                message: data?.message ?? "Success!",
                type: "success",
                description: data?.description;
            }),
            errorNotification: (error, values, resource) => ({
                message: error?.message ?? error?.code ?? "Error!",
                type: "error",
                description: error?.reason;
            })
            /* ... */
        });
    }

3.44.0

Minor Changes

  • Added ability to compare or filters. This was a missing feature on filters in useTable hook. With this feature, we will prevent or filter bugs (Resolves #2124) such as re-adding the same filters and being unable to modify or filter. To remove or filter with merge behavior, you should pass an empty object as value.

Patch Changes

  • Fix redirection after submit in useForm. Both edit and create will redirect to list (it was edit previously)

    Resolves #2123

3.43.1

Patch Changes

  • #2172 c33d13eb15 Thanks @aliemir! - Fix redirection after submit in useForm. Both edit and create will redirect to list (it was edit previously)

    Resolves #2123

3.43.0

Minor Changes

  • #2164 4d5f6b25e5 Thanks @aliemir! - Added ability to compare or filters. This was a missing feature on filters in useTable hook. With this feature, we will prevent or filter bugs (Resolves #2124) such as re-adding the same filters and being unable to modify or filter. To remove or filter with merge behavior, you should pass an empty object as value.

3.42.0

Minor Changes

  • @pankod/refine-core

    • Added extra params to useSubscription and useResourceSubscription
    • useOne, useMany and useList passed extra params to own subscription hook.

    @pankod/refine-hasura

    • Added liveProvider.

    To see an example of how to use it, check out here.

    @pankod/refine-nhost

    • Added liveProvider.

    To see an example of how to use it, check out here.

    @pankod/refine-graphql

    • Added liveProvider.

Patch Changes

  • Fixed it to appear in menu items even if List is not given in resources #2147

3.41.1

Patch Changes

3.41.0

Minor Changes

  • #2120 2aa7aace52 Thanks @salihozdemir! - ### @pankod/refine-core

    • Added extra params to useSubscription and useResourceSubscription
    • useOne, useMany and useList passed extra params to own subscription hook.

    @pankod/refine-hasura

    • Added liveProvider.

    To see an example of how to use it, check out here.

    @pankod/refine-nhost

    • Added liveProvider.

    To see an example of how to use it, check out here.

    @pankod/refine-graphql

    • Added liveProvider.

3.40.0

Minor Changes

  • Add a simple and transparent telemetry module to collect usage statistics defined within a very limited scope.

    Tracking is completely safe and anonymous. It does not contain any personally identifiable information and does not use cookies. Participation is optional and users can opt out easily.

    For more information, you can check the documentation.

3.39.0

Minor Changes

  • #2078 868bb943ad Thanks @yildirayunlu! - Add a simple and transparent telemetry module to collect usage statistics defined within a very limited scope.

    Tracking is completely safe and anonymous. It does not contain any personally identifiable information and does not use cookies. Participation is optional and users can opt out easily.

    For more information, you can check the documentation.

3.38.2

Patch Changes

    • The redirect method that return from useForm updated to be avaiable for passing id.
    const { redirect } = useForm();
    
    redirect("edit", id);
    • Returning API response to onFinish function for successful mutations

3.38.1

Patch Changes

  • #2089 ee8e8bbd6c Thanks @ozkalai! - - The redirect method that return from useForm updated to be avaiable for passing id.

    const { redirect } = useForm();
    
    redirect("edit", id);
    • Returning API response to onFinish function for successful mutations

3.38.0

Minor Changes

  • useLog is converted to useQuery mutation.

    // before
    const { log } = useLog();
    log({
      resource: 'posts',
      action: 'create',
      data: {
          id: 1
      }
    });
    // after
    const { log } = useLog();
    const { mutation } = log;
    mutation({
      resource: 'posts',
      action: 'create',
      data: {
          id: 1
      }
    });

Patch Changes

  • Fixed useBreadcrumb hook throws console.warn even if i18nProvider is not used - #2103

3.37.0

Minor Changes

  • #2049 98966b586f Thanks @yildirayunlu! - useLog is converted to useQuery mutation.

    // before
    const { log } = useLog();
    log({
      resource: 'posts',
      action: 'create',
      data: {
          id: 1
      }
    });
    // after
    const { log } = useLog();
    const { mutation } = log;
    mutation({
      resource: 'posts',
      action: 'create',
      data: {
          id: 1
      }
    });

Patch Changes

  • #2104 9d77c63a92 Thanks @omeraplak! - Fixed useBreadcrumb hook throws console.warn even if i18nProvider is not used - #2103

3.36.0

Minor Changes

  • Ability to disable server-side pagination on useTable and useList hooks.

    Implementation

    Added hasPagination property to useTable to enable/disable pagination. Updated useList config with no pagination option. Set hasPagination to false to disable pagination. useTable hook uses the useList hook under the hood and propagates the hasPagination property to it. Also setting pagination related return values to undefined for better type check on the user side.

    Use Cases

    In some data providers, some of the resources might not support pagination which was not supported prior to these changes. To handle the pagination on the client-side or to disable completely, users can set hasPagination to false.

Patch Changes

  • Added actions translate support for CRUD operations (list,create,edit,show) in the useBreadcrumb useBreadcrumb hook.

    ️⃣ First, We need to add the actions key to the translation file.

        "actions": {
            "list": "List",
            "create": "Create",
            "edit": "Edit",
            "show": "Show"
        },

    ️⃣ If you don't provide the actions key, useBreadcrumb will try to find the buttons key in the translation file for backward compatibility.

        "buttons": {
            "list": "List",
            "create": "Create",
            "edit": "Edit",
            "show": "Show"
        },

    🎉 You can check the code part of this pull request to see how it works here👇🏼

    const key = `actions.${action}`;
    const actionLabel = translate(key);
    if (actionLabel === key) {
        console.warn(
            `Breadcrumb missing translate key for the "${action}" action. Please add "actions.${action}" key to your translation file. For more information, see https://refine.dev/docs/core/hooks/useBreadcrumb/#i18n-support`,
        );
        breadcrumbs.push({
            label: translate(`buttons.${action}`, humanizeString(action)),
        });
    } else {
        breadcrumbs.push({
            label: translate(key, humanizeString(action)),
        });
    }

3.35.0

Minor Changes

  • #2050 635cfe9fdb Thanks @ozkalai! - Ability to disable server-side pagination on useTable and useList hooks.

    Implementation

    Added hasPagination property to useTable to enable/disable pagination. Updated useList config with no pagination option. Set hasPagination to false to disable pagination. useTable hook uses the useList hook under the hood and propagates the hasPagination property to it. Also setting pagination related return values to undefined for better type check on the user side.

    Use Cases

    In some data providers, some of the resources might not support pagination which was not supported prior to these changes. To handle the pagination on the client-side or to disable completely, users can set hasPagination to false.

Patch Changes

  • #2069 ecde34a9b3 Thanks @biskuvit! - Added actions translate support for CRUD operations (list,create,edit,show) in the useBreadcrumb useBreadcrumb hook.

    ️⃣ First, We need to add the actions key to the translation file.

        "actions": {
            "list": "List",
            "create": "Create",
            "edit": "Edit",
            "show": "Show"
        },

    ️⃣ If you don't provide the actions key, useBreadcrumb will try to find the buttons key in the translation file for backward compatibility.

        "buttons": {
            "list": "List",
            "create": "Create",
            "edit": "Edit",
            "show": "Show"
        },

    🎉 You can check the code part of this pull request to see how it works here👇🏼

    const key = `actions.${action}`;
    const actionLabel = translate(key);
    if (actionLabel === key) {
        console.warn(
            `Breadcrumb missing translate key for the "${action}" action. Please add "actions.${action}" key to your translation file. For more information, see https://refine.dev/docs/core/hooks/useBreadcrumb/#i18n-support`,
        );
        breadcrumbs.push({
            label: translate(`buttons.${action}`, humanizeString(action)),
        });
    } else {
        breadcrumbs.push({
            label: translate(key, humanizeString(action)),
        });
    }

3.34.2

Patch Changes

  • Fixed useImport onFinish twice call bug.

3.34.1

Patch Changes

3.34.0

Minor Changes

  • Added i18n support for resource names on useBreadcrumb hook.

  • Export RefineProps and ResourceProps type.

Patch Changes

  • We have fixed texts with translations of default login pages in Material UI and Headless.

3.33.0

Minor Changes

Patch Changes

  • #2029 b257d87fef Thanks @ozkalai! - We have fixed texts with translations of default login pages in Material UI and Headless.

3.32.0

Minor Changes

  • Add useMenu hook to @pankod/refine-core

Patch Changes

  • Add custom route support to defaultOpenKeys in useMenu

  • Handle the undefined case at audit-log logger in data hooks.

  • Remove dashboard item in useMenu hook

3.31.0

Minor Changes

Patch Changes

3.30.0

Minor Changes

  • Add useMenu hook to @pankod/refine-core

Patch Changes

  • Add custom route support to defaultOpenKeys in useMenu

  • Handle the undefined case at audit-log logger in data hooks.

3.29.2

Patch Changes

  • Fix hook-inside-hook call in notificationProvider setup at <Refine/>

3.29.1

Patch Changes

3.29.0

Minor Changes

  • Updated notificationProvider prop in the Refine wrapper component to be able to lazily initialized.

3.28.0

Minor Changes

  • Updated notificationProvider prop in the Refine wrapper component to be able to lazily initialized.

3.27.0

Minor Changes

  • Updated notificationProvider prop in the Refine wrapper component to be able to lazily initialized.

3.26.0

Minor Changes

  • #1896 2ba2a96fd2 Thanks @aliemir! - Updated notificationProvider prop in the Refine wrapper component to be able to lazily initialized.

3.23.2

Patch Changes

  • #1873 2deb19babf Thanks @aliemir! - Removed dummy default values from internal contexts. Updated contexts:

    • Auth
    • Access Control
    • Notification
    • Translation (i18n)
    • unsavedWarn

    BREAKING: useGetLocale hook now can return undefined instead of a fallback value of en in cases of i18nProvider being undefined.

3.23.1

Patch Changes

3.23.0

Minor Changes