-
-
Notifications
You must be signed in to change notification settings - Fork 596
Included objects decay to pointers when updating #91
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
I'm having the same issue. |
Same. This is wrecking havoc with my cloud code. |
I'm seeing the same error. |
I believe I have a fix. The "known server data" in the save response was overaggresively overwriting local data. Once I have some extra unit tests in place, I'll attempt to push this later today. |
Actually, I'm stumped. I added some extra checks that I thought might help, but then I went back to make some unit tests that only pass with the new changes, and I was unable to make anything fail prior to these changes. I went back and ran Tyler's tests line-by-line in node using v1.6.13, and I get the expected "correct" behavior, no matter which objects I manipulate. Since there are so many people here with the same issue, can someone please come up with a reproducible test case? |
I'll try to rewrite one. I'm sorta tight on time so it won't be right this second. |
Andrew, I also see the test work with 1.7.0, however we see this happen in production a lot in the following case:
|
@TylerBrock is that using |
No, using parse classic, we haven't moved off yet. |
Okay, got confused by the "same api server" bit. I'll take a look and see if I can repro this. |
Thanks, let me know if i can help. We resolve the issue by storing the included object properties in a higher scope and then not depending on it further down the promise chain after the object decays. |
This is the annotated block of code where we have the hack for the decay (one example of it at least) var phoneNumber;
var messageQuery = new Parse.Query(Message);
messageQuery.equalTo("sid", sid);
messageQuery.include("fromAgent");
messageQuery.first().then(function(message) {
// We do this because message decays after being saved :-(
phoneNumber = message.get('fromAgent').get('phoneNumber');
message.set("status", newStatus);
// ... do other stuff with message
// message has a beforeSave() where we hydrate the object and serialize it back out
// on this very same instance of Parse and that happens in between the next two lines
return message.save();
}).then(function(message) {
// message.get('fromAgent').get('phoneNumber') is undefined here
// this is where we use fromAgents's phone number....
} |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
We are seeing strange behavior that is different that that of the JS 1.5 and lower SDK in that when we update a field on an object that has included objects (fully hydrated), we see that the included objects decay to pointers after performing the update. We want to add this to the list of things we've discovered as blockers in #73.
This is a reproduction using the Parse JS SDK 1.6.9:
Setup
Test
When we attempt the same actions in the 1.5 SDK and lower the pointers do not decay (run line by line in our node REPL)
The text was updated successfully, but these errors were encountered: