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

Form with array of objects automatically added with array of itself with Ids suffix #4067

Closed
Tanapruk opened this issue Nov 28, 2019 · 4 comments

Comments

@Tanapruk
Copy link

What you were expecting:

Clicking save after editing should send like.

{
 categories: [{
"id": "1234",
"name": "nice"
}]
}

What happened instead:
Clicking save after editing should send like.
a new field called categoriesIds are magically added and fail my graphql

{
 categories: [{
"id": "1234",
"name": "nice"
}],
categoriesIds: ["1234"]
}

Steps to reproduce:
It happened after upgrading to 3.0.0. My best guess is the react-final-form automatically created the params with Ids suffix, since it shows the ids inside . I try to create a new fields with array of objects but that do not show the problems.

For now, I fix it by removing fields with ids suffix at the dataProvider.

Environment

  • React-admin version: 3.0.1
  • Last version that did not exhibit the issue (if applicable): 2.98
  • React version: 16.8
  • Browser: Chrome
  • Stack trace (in case of a JS error):
@djhi
Copy link
Collaborator

djhi commented Nov 28, 2019

Thanks for reporting this. If you are able to illustrate the bug or feature request with an example, please provide a sample application via one of the following means:

@wmwart
Copy link

wmwart commented Dec 3, 2019

@Tanapruk, This is normal work and React-admin feature.
Why does your GraphQL not work? I use GraphQL-Yoga for the backend and this solution not only does not break, but also helps in development.

However, there is one problem that I described here. The React-admin also converts my JsonInput in the same way, which sends a custom data object to the Provider.
@djhi, what do you think about this?

@Tanapruk
Copy link
Author

Tanapruk commented Dec 3, 2019

@wmwart I guess my problem is similar to yours but I couldn't make a minimum project to reproduce it right now.

@fzaninotto
Copy link
Member

fzaninotto commented Dec 3, 2019

Should be fixed by #4103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants