-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
Desesperately need cascadeSave like parameter for the Android SDK #1006
Comments
I have implemented the "cascadeSave=false" parameter for the Android SDK in a very hacky way. That recursive collectDirtyChildren method is really messy and is the culpruit for all the hangs when saving any object. The ParseObject class should provide a paramter to choose wether or not save the children objects, but most important, it should have that method fixed, it hangs every device when you try to save any complex object, with some nested children. It is because of the LDS. With my modification I can use the LDS and save objects without hangs. And when I need to save some object with children, I add the object and the children to an array then I use saveAll, no need for that buggy default cascade save true. I'm using LDS, so I'm even checking for internet connection and when there is no connection, I use nested saveEventuallys for the children. Everything working great, it takes some more lines of coding to save an object, but anything is better than the faulty buggy default save with its cascade save behaviour, or better than shut LDS off, and better than write cloud code to save in the cloud because of the faulty save in the client. |
Dear ramiro-ciocca , |
I know, that save issue is a nigthmare, it hangs the app on every device or it takes minutes to complete a save. From now on, you have to be aware that if you need to save childrens of some object, you have to do it explicity, like Children.save(...), alongside with parent object. It's a more than fair deal compared to write cloud code or disable LDS. In my case and in my app at least! How I did it:
Things to be aware of:
All this issue took weeks of my time and frustration till I arrived to this "solution". Sincerely hope someone from this great community with real knowledge really fixes LDS and save issues. |
And here I thought I was doing something wrong lol. I posted a similar issue before I saw yours .
This will crash. But if i do something like this
So this tells us one thing , the object which the user class is pointing to has to be saved first onto the server and after getting that object on callback can we put in into user and then call saveEventually on user again. |
This is hurting quite badly in some circumstances where I'm unable to save a single, cycle free object never succeeds. The issue clearly is in the The function uses a The code in question is unfortunately rather confusing (who names their variables This is the code in question: Parse-SDK-Android/parse/src/main/java/com/parse/ParseObject.java Lines 606 to 625 in 797786f
If the current object is not new, i.e. has an The inefficiency would come into play in situations like this:
When A dives into B and B traverses D, it adds it to An obvious improvement is to remove the line A bit sad to see that there barely are any unit tests for the |
When Local Data Store is enabled and you have very complex ParseObjects with pointers to other ParseObjects, save methods insice ParseObject.java go mad and it can take minutes to complete a simple save.
I have tracked down the issue till line 662 of ParseObject.java, where is called collectDirtyChildren that enters and insane almost infinite loop traversing every single attribute of every single nested object pinned in the entire LDS, not just the objects Im saving.
I understand that is a functionallity that many developers would use, but we need a way to say "we dont want to save children objects" to the save method, just like in JS SDK, with the cascadeSave=false.
Because of this LDS issue, I'm forced to write cloud code for every single save, or disallow LDS.
Please, if I could comment that line I think that would be the solution, but it is into an aar file, I dont know how to modify that.
Thanks!
The text was updated successfully, but these errors were encountered: