{"record":{"id":"335cd25604b677ff","repo":"marmelab/react-admin","slug":"inplaceeditor-requires-either-a-source-prop-or-chi","errorCode":null,"errorMessage":"InPlaceEditor requires either a source prop or children or editor prop","messagePattern":"InPlaceEditor requires either a source prop or children or editor prop","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ra-ui-materialui/src/input/InPlaceEditor/InPlaceEditor.tsx","lineNumber":93,"sourceCode":"            />\n        ) : null,\n        editor = source ? (\n            <TextInput\n                source={source}\n                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) => {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/input/InPlaceEditor/InPlaceEditor.tsx#L75-L111","documentation":"InPlaceEditor must know what to render and where to write the edited value. It needs either a source prop (edit a record field), children (a react-admin input to edit with), or an explicit editor prop; without any of the three it throws immediately at render because the component cannot function.","triggerScenarios":"<InPlaceEditor /> rendered with none of source, children, or editor props defined.","commonSituations":"Creating an in-place editable field and forgetting to wire it to the record, or refactoring away children/source without adding the replacement prop.","solutions":["Add a source prop pointing at the record field, e.g. <InPlaceEditor source=\"title\" />","Or pass children with an input component, e.g. <InPlaceEditor><TextInput source=\"title\" /></InPlaceEditor>","Or pass an explicit editor element via the editor prop"],"exampleFix":"// before\n<InPlaceEditor />\n// after\n<InPlaceEditor source=\"title\" />","handlingStrategy":"validation","validationCode":"if (!source && !children && !editor) {\n  throw new Error('InPlaceEditor requires source, children or editor');\n}","typeGuard":"const isInPlaceEditorConfigured = (\n  p: InPlaceEditorProps\n): p is InPlaceEditorProps & ({ source: string } | { children: React.ReactNode } | { editor: React.ReactElement }) =>\n  p.source != null || p.children != null || p.editor != null;","tryCatchPattern":"try {\n  render(<InPlaceEditor {...props} />);\n} catch (e) {\n  if (e.message.includes('InPlaceEditor requires')) {\n    console.error('InPlaceEditor misconfigured:', e.message);\n  }\n}","preventionTips":["Always configure InPlaceEditor with at least one of source/children/editor at the call site","If building a wrapper, make one of the three props required in its TypeScript signature","Render InPlaceEditor only inside RecordContext so source resolves to a real field"],"tags":["react-admin","inplaceeditor","missing-prop"],"backgroundTag":"missing-required-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}