-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Having trouble Updating an item with react-admin < Edit/> component #5082
Comments
Hi, Thank you for opening this issue 🙏 I need to reproduce the problem you describe in order to fix it quickly. But I can't use your repository which is private. As explained in the bug report template:
Regards, |
I was able to recreate this in a fresh In this example, 2 different On the component exported from On the other instance mounted at There's not enough information from the original post to say that this is the same reason why @Jack-B-Lenihan had this problem but this seems to fix it in my case. |
Experience the same problem described by @Jack-B-Lenihan. I follow this tutorial. I'm writing a sample case on https://codesandbox.io, pls allow 24 hours. |
Follow this link.
Thanks for the help! |
This is not demonstrating a bug in react-admin, but a problem you're having integrating it. What you are trying to do is actually possible with react-admin (see the reviews list in the e-commerce demo, https://marmelab.com/react-admin-demo/#/reviews), so the problem lies in your code. So this issue lies in the category of "how to / troubleshooting", which should be asked on stack Overflow rather than here. |
If anybody is looking for a solution, for some reason |
Yep, I had the exact same issue - thanks very much for calling that fix out, @ssaric! It worked great for me. One of my edit views was freaking out when I tried to save. This was specific to a data type that I've termed "Roles". Problem #1: When trying to save, no GQL call is issued. However, the local cache IS updated, so the List view for that record type looked just fine, BUT, I was also having a new issue... Problem #2: After clicking save on the record in question, and returning to any other List views I looked at, after the bug manifested, all of the other List views are now showing the WRONG data type. I have data types like Policies, Views, Menus, and Content, to name a few. Once this issue manifested (ie. after clicking Save on the Roles data type), every other List view only shows me data from Roles and not from their proper data source. @fzaninotto: |
What you were expecting:
Upon hitting the edit button on a list item the edit component properly renders with all the correct data for the item passed into its form. When I edit a field and hit save I expected the dataprovider.update() method to create the request and send it to the update route handler I'd written on the backend. Then either successfully update the product or provide some relevant error message.
What happened instead:
When the save button is hit I see in my server that the route handler for getOne is firing. I understand that getOne is called for rendering the edit component but I did not think it is supposed to fire for the save function. Also, the onSuccess function on the comp (copied from docs) throws an err in the js console saying that it's data prop is undefined. Meanwhile the save button stays permanently pressed down with a loading symbol on it and the browser tab.
Steps to reproduce:
You will see the getOne route handler firing in the server and the onSuccess func throw it's error in the js console in Chrome
Git clone link: https://github.com/cbddy/wholesale-portal.git
relevant files:
frontend
backend
-server/server.js
-server/admin-routes/admin-product.router.js
The text was updated successfully, but these errors were encountered: