[Bug] updateMany broken in ra-data-graphql-simple in 3.19.x

What you were expecting:

Calling updateMany in the 3.19.x version ra-data-graphql-simple correctly calls the graphql mutation.
What happened instead:

Instead, you get an error that ID isn’t defined.

Related code:
The issue here is that the location of the id field got moved when the dataprovider was updated as part of 3.19. In the previous version it was a child of data : github.com/marmelab/react-admin/blob/0861691abcb70aeb33515ad959c9c23c20dd2e57/packages/ra-data-graphql-simple/src/index.js#L44 But in the current version id is a sibling of the data: github.com/marmelab/react-admin/blob/master/packages/ra-data-graphql-simple/src/index.ts#L47

This causes the issue because the function buildCreateUpdateVariables expects id to be a child of data: github.com/marmelab/react-admin/blob/851f2da9f8de2505ad17073f896947ad698bc75e/packages/ra-data-graphql-simple/src/buildVariables.ts#L291 So no id is put in the variables object which means Apollo gets sad that one of the required fields isn’t there and throws an error.


  • React-admin version: 3.19.1 version of ra-data-graphql-simple
  • Last version that did not exhibit the issue (if applicable): 3.18.3 of ra-data-graphql-simple

Read more here: Source link