RFC: Mutate vs. copy
Closed this issue · 1 comments
nateabele commented
Currently, when submitting a POST or PATCH request against a resource, the representing object is updated with values returned in a successful response.
Instead of updating the existing instance of the object, we could return a new, updated copy, thus maintaining less mutable state. Thoughts?
wms commented
I think a ModelInstance is most useful and consistent when used as a way to maintain state; that is, as it works currently.
If a user wishes to get at returned data, they can tap the $save promise chain (although that data would be a POJO, not a ModelInstance).
Seeing as we're making plans to move towards adapters and strategies, perhaps this could be configurable, with the current behaviour as the default.