-
-
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
the onSuccess property does not work in the Edit and Create component #5785
Comments
Please follow the issue template |
I'm observing the same issue. Sandbox: https://codesandbox.io/s/laughing-bardeen-mwq4s?file=/src/posts/Edit.js |
What you were expecting: What happened instead: Related code:
Environment
|
The This is a known gotcha of the optimistic / undoable mode (it relies on the trigger of a notification), but not a bug. You can fix it in your code by adding a call to import React from 'react'
-import { Edit, SimpleForm } from "react-admin"
+import { Edit, SimpleForm, useNotify } from "react-admin"
import Form from './form'
export default (props) => {
+ const notify = useNotify();
const onSuccess = () => {
console.log("onSuccess");
+ notify('success', 'info', null, true);
}
return (
<Edit {...props} onSuccess={onSuccess}>
<SimpleForm>
<Form />
</SimpleForm>
</Edit>
);
} You can also use That being said, I agree that the documentation at https://marmelab.com/react-admin/CreateEdit.html#onsuccess isn't clear enough about this point. I'm turning this into a documentation issue. |
Ok! Thank you for your support |
There is another problem.
React-admin version: 3.11.3 |
leave here or create a new issue? |
I believe this doc enhancement has been made with the new |
Fixed by #5799 |
When the onSuccess property is added to the Edit or Create component, the SaveButton component stops working.
Environment
The text was updated successfully, but these errors were encountered: