You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The payload values from useCustomMutation hook are not being passed to the GraphQL custom dataprovider to be sent onwards to urql. Although the values parameter in the useCustomMutation hook is required, the custom section of the dataprovider does not use this parameter value.
From line 145, where it is being stored in payload.
Steps To Reproduce
Create a new file with the following code
const{ mutate }=useCustomMutation();consthandleCreateCustomData=()=>{mutate({url: API_URL,values: {//Although required by TypeScript this does not get passed through.val1: "Value",val2: "Value2"},method: "post",meta: {gqlMutation: <GQL_MUTATION>,
},});};
The values are not being passed to the graphQL and it expects gqlVariables populated through meta.
into the buildVariables function before line 292 below, as you can see in the code block below it is only taking the meta variables and not the payload from the useCustomMutation hook.
@yousef-romany Yes. That is exactly what I asked for in the Expected behaviour section of the bug I filed, except I put it at the top instead of the bottom. Either will do.
For now we can overide the options.ts, but would be good to have a fix.
Describe the bug
The payload values from useCustomMutation hook are not being passed to the GraphQL custom dataprovider to be sent onwards to urql. Although the values parameter in the useCustomMutation hook is required, the custom section of the dataprovider does not use this parameter value.
In the graphql/src/dataProvider/options.ts
refine/packages/graphql/src/dataProvider/options.ts
Lines 288 to 294 in e4a8f2f
The required payload:values from variables are not being passed in from the useCustomMutation hook.
refine/packages/core/src/hooks/data/useCustomMutation.ts
Lines 142 to 149 in e4a8f2f
From line 145, where it is being stored in payload.
Steps To Reproduce
Create a new file with the following code
The values are not being passed to the graphQL and it expects gqlVariables populated through meta.
Expected behavior
Add in the line
...(typeof params.payload === "object" ? params.payload : undefined),
into the buildVariables function before line 292 below, as you can see in the code block below it is only taking the meta variables and not the payload from the useCustomMutation hook.
refine/packages/graphql/src/dataProvider/options.ts
Lines 288 to 294 in e4a8f2f
Packages
Additional Context
The same is done on the buildVariables in the update part of the graphql dataprovider, so seems to have been missed out on the useCustomMutation.
refine/packages/graphql/src/dataProvider/options.ts
Lines 220 to 226 in e4a8f2f
The text was updated successfully, but these errors were encountered: