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
Steps to reproduce:
Git clone link: https://github.com/cbddy/wholesale-portal.git
relevant files:
frontend
Hi,
Thank you for opening this issue :pray:
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,
Adrien
I was able to recreate this in a fresh create-react-app available here: https://github.com/numtel/react-admin-demo-5082/commit/3b5c56f9513e91d3f89984b093008193c0521cfa
In this example, 2 different react-admin instances are created inside of a react-router.
On the component exported from admin.js and mounted at /admin, the update and delete events are never invoked on the [extremely bare-bones] dataProvider.
On the other instance mounted at /other-admin, the same [duplicated] code is used but it is supplied as children to the <Route> component instead of as the component attribute.
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 wrote the GetOne specifically just to comply to the doc. But the SaveButton doesn't call the DataProvider.update.
I follow this tutorial.
https://marmelab.com/blog/2019/02/07/react-admin-advanced-recipes-creating-and-editing-a-record-from-the-list-page.html
The demo for this tut works but it isn't using the latest version and written in 2019.
I'm writing a sample case on https://codesandbox.io, pls allow 24 hours.
Follow this link.
https://codesandbox.io/s/loving-voice-qvtdk?file=/src/posts/PostList.js
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 undoable in edit is causing problems. Set it to false, and update endpoint will get called. Don't know whats going on, I am trying to put this component under a special endpoint, and the parent app is managed with MobX so for some reason it might conflict, but after good 5h I finally got the update to work properly.
Most helpful comment
Follow this link.
https://codesandbox.io/s/loving-voice-qvtdk?file=/src/posts/PostList.js
Thanks for the help!