-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Is your feature request related to a problem? Please describe.
It may be better to access previous data state(to be exact, before saved state) from save and transform method than it is only accessible from dataProvider.
Now, as I know with reading code useEditController and react-admin document, DataProvider is only way (except for customizing default component) to access previousData, but as more resource depended logics are implemented though intrinsically they are loosely coupled, it is fat soon.
If it can be accessed from transform and save methods, it's convenient for limiting scope narrower and modifying request parameter logic form layer can be completed, in the result, we will no longer implement conditional logic using previousData in dataProvider, then more agnostic feature against resource type.
Describe the solution you'd like
Add more the previousData argument and assign indirect record
this line
and pass record value second parameter this code.
Describe alternatives you've considered
I read this section of document.
Edit props completely rewritable and provide alternative controller props to store state of previous data. So, if this features implements not desired for framework, we can make this feature.
Additional context
We use array input for many relation data from parent form.
And, to sync data, we put delete flag to deleted record on Remove event, and request all records including deleted flagged records which disappears in browser window to complete request only once.
This can be alternated by making custom array input and but it's noting worth to control before submitting event phase because we rewriting many logic of original ArrayInput compared to rewrite Edit transform of form save method.