Patterns
Edit a Record
Change something and the Save button turns on. Discard puts the loaded values back. Turn on “Fail the next save” to see a failed save keep your edits.
What this shows
Load a record, edit it and save it. See Loading and Saving Data.
resetInitialValues(record)loads fetched data as the new initial values.useIsDirty()enables Save only when something changed, andhandleReset()discards the edits.- When the save fails,
onSubmitresolves tofalse, so the initial values are kept and the edits stay. checkIsDirty()asks before switching to another record.