Skip to content

[BUG] useDataGrid + GraphQL: update does not receive meta.gqlMutation for editable cell #6833

Open
@kdevo

Description

@kdevo

Describe the bug

When using useDataGrid with updateMutationOptions and editable: true, the receiving hook does not get passed the metadata for determining the required GraphQL mutation when a cell/row update is performed.

Steps To Reproduce

Data Grid:

const { 
      dataGridProps,
     } = useDataGrid<IPost>({
        resource: "posts",
        meta: { 
            operation: "PostList",
            gqlQuery: POST_LIST, 
            gqlMutation: POST_UPDATE,
        },
        pagination: {mode: "client", pageSize:20},
        editable: true,
        updateMutationOptions: {
            meta:{
                gqlMutation: POST_UPDATE,
            },
            retry: 1,
        }
    });

With at least one editable column:

            // ...
            {
                field: "name",
                headerName: "Name",
                type: "string",
                minWidth: 500,
                sortable: true,
                filterable: false,
                editable: true,
            }

Expected behavior

Editable performs a call to update of the (GraphQL) data provider with POST_UPDATE as gqlOperation:

      const { meta } = params;
      const gqlOperation = meta?.gqlMutation ?? meta?.gqlQuery;

Packages

        "@refinedev/cli": "^2.16.21",
        "@refinedev/core": "^4.57.9",
        "@refinedev/devtools": "^1.1.32",
        "@refinedev/graphql": "^7.1.3",
        "@refinedev/inferencer": "^5.0.3",
        "@refinedev/kbar": "^1.3.6",
        "@refinedev/mui": "^6.0.0",
        "@refinedev/react-hook-form": "^4.8.14",
        "@refinedev/react-router": "^1.0.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions