Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit screen doesn't work with ra-data-graphql-simple if resource id is of type Int! #5400

Closed
EmrysMyrddin opened this issue Oct 14, 2020 · 0 comments · Fixed by #5402
Closed

Comments

@EmrysMyrddin
Copy link
Contributor

What you were expecting:

given this schema simplified schema:

type Query {
  Entity(id: Int!): Entity
}

type Entity {
  id: Int!
}

I expect to be able to click on a row of a DataGrid displaying the list of Entity and seeing an Edit screen for Entity.

What happened instead:

We get an error Element does not exist and we a redirected to the list of Entity. The error message is incorrect, the real error is that the id variable is given as a string instead of a number.

Other information:

The issue is caused by the castType function (buildVariable.js:27). This function should cast the id variable to type string but it doesn't work with non nullable types.

In the castType function, we should check if the type's kind is NON_NULL, and in this case use type.ofType to discover the real type of the argument.

Environment

  • React-admin version: 3.9.2
  • Last version that did not exhibit the issue (if applicable):
  • React version: 16.13.1
  • Browser: Chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant