The custom form shown here:
https://marmelab.com/react-admin/CreateEdit.html#custom-form-component
No longer works with react-admin v3.11
I copy-paste the above sample as the Post form in the following sandbox:
https://codesandbox.io/s/charming-mahavira-kuphi?file=/src/posts/PostCreate.js
TypeError: Cannot read property 'save' of undefinedEnvironment
@WiXSL follow documentation properly,enclose FormWithRedirect Component within Create tags and replace resource and source props in Input fields with correct value
My example wasn't the best. But I have code like that, that was working before verion 3.11.
I'll re-do the example.
Basically I have a mui Dialog with a FormWithRedirect inside that is opened from a List bulkActionButtons's button.
Using FormWithRedirect outside of Create or Edit isn't something we encourage. Use react-final-form's <Form> component for such cases.
Same here, three views on my side were broken after 3.11 update. Changing from the react-admin SimpleForm to the Form component from react-final-form and reimplementing handleSubmit fixed them. But this is a dangerous breaking change introduced for many users here. They are some SO post talking about it.
I'm sorry that you were bitten by this as well, but it's not a breaking change if the feature was never documented.
@fzaninotto , the DEMO examples are not updated to this latest changes
@alextaymx Not sure what you're talking about. Can you be more specific?
SaveContext of course.@fzaninotto , if i'm not mistaken, in the demo repo, the Review Edit part https://github.com/marmelab/react-admin/blob/master/examples/demo/src/reviews/ReviewEdit.tsx is using SimpleForm without Edit component, this is where the error pops out.
@alextaymx You're right. Since @WiXSL's patch, it only logs a warning, but it should be changed. I'll update the demo.
Most helpful comment
5738 has just been merged, which solves the problem (At least the one I reported) at least until the next mayor release. By then it would be my responsibility to upgrade my code to use
SaveContextof course.