MrHertal / react-admin-amplify

AWS Amplify data provider for react-admin.
MIT License
159 stars 42 forks source link

1:1 relationships #58

Closed pafela closed 3 years ago

pafela commented 3 years ago

As there's no example on the demo code I've tried to get one to one relationships working. There is no problem when you only try to create entries in the table using the standard create component. But if you try to update a record there throws an error saying "The variables input contains a field name 'ABC' that is not defined for input object type '123' ". As mentioned, with exactly the same schema creations are possible which uses ABC at 123-type.

the schema looks like this:

@model
{
id: ID!
something: String
}

type 123
  @model
{
id: ID!
anything: String
abcID: ID
abc: abc! @connection(fields: ["abcID"])
}
MrHertal commented 3 years ago

Hi, it looks similar to that issue: https://github.com/MrHertal/react-admin-amplify/issues/41

Please try the transform props as described here: https://github.com/MrHertal/react-admin-amplify/issues/41#issuecomment-787456238

bjacog commented 3 years ago

@pafela this is caused by a bug in react-admin. You need to use a transform on your Edit component to remove the abc key from the input sent to the graphql mutation.