{"record":{"id":"2287e29e31e34ae5","repo":"marmelab/react-admin","slug":"inplaceeditor-requires-notifyonsuccess-to-be-true","errorCode":null,"errorMessage":"InPlaceEditor requires notifyOnSuccess to be true when mutationMode is undoable","messagePattern":"InPlaceEditor requires notifyOnSuccess to be true when mutationMode is undoable","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ra-ui-materialui/src/input/InPlaceEditor/InPlaceEditor.tsx","lineNumber":98,"sourceCode":"                size=\"small\"\n                margin=\"none\"\n                label={false}\n                variant=\"standard\"\n                autoFocus\n                helperText={false}\n            />\n        ) : null,\n        showButtons,\n        notifyOnSuccess,\n    } = props;\n\n    if (!source && !children && !editor) {\n        throw new Error(\n            'InPlaceEditor requires either a source prop or children or editor prop'\n        );\n    }\n    if (mutationMode === 'undoable' && !notifyOnSuccess) {\n        throw new Error(\n            'InPlaceEditor requires notifyOnSuccess to be true when mutationMode is undoable'\n        );\n    }\n\n    const submitButtonRef = useRef<HTMLButtonElement>(null);\n\n    const [state, dispatch] = useReducer<\n        (\n            state: InPlaceEditorValue,\n            action: InPlaceEditorAction\n        ) => InPlaceEditorValue\n    >(\n        (_, action) => {\n            switch (action.type) {\n                case 'edit':\n                    return { state: 'editing' };\n                case 'save':\n                    return { state: 'saving', values: action.values };","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/input/InPlaceEditor/InPlaceEditor.tsx#L80-L116","documentation":"In undoable mutationMode, the edit is applied optimistically and then announced; InPlaceEditor relies on notifyOnSuccess to show the success notification that supports the undo flow. If mutationMode is 'undoable' and notifyOnSuccess is falsy, the library throws because the undoable flow cannot work correctly.","triggerScenarios":"<InPlaceEditor mutationMode=\"undoable\" /> (the default in some contexts) rendered without notifyOnSuccess={true} or with notifyOnSuccess explicitly false.","commonSituations":"Setting mutationMode=\"undoable\" for optimistic updates but disabling notifications, or copying an example that sets notifyOnSuccess={false} (valid for pessimistic/undoable-less modes) into an undoable setup.","solutions":["Set notifyOnSuccess={true} on the InPlaceEditor","Or change mutationMode to \"pessimistic\" or \"optimistic\" if notifications are not wanted"],"exampleFix":"// before\n<InPlaceEditor source=\"title\" mutationMode=\"undoable\" notifyOnSuccess={false} />\n// after\n<InPlaceEditor source=\"title\" mutationMode=\"undoable\" notifyOnSuccess />","handlingStrategy":"validation","validationCode":"if (mutationMode === 'undoable' && !notifyOnSuccess) {\n  throw new Error('undoable InPlaceEditor requires notifyOnSuccess');\n}","typeGuard":"const validInPlaceEditorMutation = (\n  p: Pick<InPlaceEditorProps, 'mutationMode' | 'notifyOnSuccess'>\n): boolean => p.mutationMode !== 'undoable' || p.notifyOnSuccess === true;","tryCatchPattern":"try {\n  render(<InPlaceEditor source=\"title\" mutationMode=\"undoable\" />);\n} catch (e) {\n  if (e.message.includes('notifyOnSuccess')) {\n    console.error('Undoable mode needs notifications:', e.message);\n  }\n}","preventionTips":["Pair mutationMode=\"undoable\" with notifyOnSuccess in every usage","Choose pessimistic/optimistic mode when notifications are undesirable","Centralize default InPlaceEditor props in a shared component"],"tags":["react-admin","inplaceeditor","mutationmode"],"backgroundTag":"incompatible-props-combination","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}