Parse-sdk-js: Option to prevent cascade saving

Created on 14 Jul 2019  路  7Comments  路  Source: parse-community/Parse-SDK-JS

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 call rever() in order not to get the Object 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.

enhancement good first task resolved

Most helpful comment

Is this still untaken? I鈥檓 taking it

All 7 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鈥檓 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 Parse.Object.save(), so you don't get data saved which you didn't explicitly intended to, just the object on which you called the function.

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

Related to this, I've noticed that Parse.Object.revert() affects also nested objects, same way. Do you think it's worth opening an issue for it?

Are sure it affects the nested objects? Could you write a test case?

False alarm. It does not affect nested objects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oallouch picture oallouch  路  4Comments

Gyran picture Gyran  路  5Comments

futureinapps picture futureinapps  路  3Comments

dplewis picture dplewis  路  7Comments

dylankbuckley picture dylankbuckley  路  4Comments