-
-
Notifications
You must be signed in to change notification settings - Fork 596
Option to prevent cascade saving #864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@RaschidJFR would you be willed to tackle this one? |
I'd love to but currently I've got my hands full. Hopefully I'll work on the docs next week. If this task is still untaken by then I will take it. |
Is this still untaken? I’m taking it |
Hey guys. So I've implemented this option, but as I was discussing with @davimacedo , we need to make sure this parameter's scope is clear. What I intend to do here is give an option not to save the whole chain of nested objects when you call I think it is important that new objects always get saved despite this parameter's value in order to keep the relational data and leverage the simplicity of the default behaviour, which is great. Opinions? P.S. take a look at the test case so you can clearly understand the proposed behaviour |
* feat(ParseObject): Add option `cascadeSave` to save() Closes #864 * fix(ParseObject): Safe check for unsaved in save() * refactor(ParseObject): `cascadeSave` won't save new objects Nested objects who have not been saved will be ignored when setting `cascadeSave: true`, so save() will throw "Cannot create Pointer to an unsaved ParseObject".
Related to this, I've noticed that |
Are sure it affects the nested objects? Could you write a test case? |
False alarm. It does not affect nested objects. |
Is your feature request related to a problem? Please describe.
When saving an object in which properties there's a pointer to another object, the SDK launches a batch operation to save all modifications made to all nested objects, which is great but... when you don't have write access to any of those (for example when you're saving a Message object pointing to another user's profile) you need to make sure nested objects are not
dirty
or callrever()
in order not to get theObject not found
error.Describe the solution you'd like
A parameter in the saving options, something like
ParseObject.save(null, {cascadeSave: false})
would address this issue.Describe alternatives you've considered
A workaround for now is to call
Parse.Object.revert()
on all objects to which you know this user does not have write permissions.The text was updated successfully, but these errors were encountered: