-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Add sending unsaved ParseObjects to Clients #1256
base: alpha
Are you sure you want to change the base?
Conversation
Danger run resulted in 1 warning; to find out more, see the checks page. Generated by 🚫 dangerJS |
Codecov Report
@@ Coverage Diff @@
## master #1256 +/- ##
=======================================
Coverage 99.98% 99.98%
=======================================
Files 57 57
Lines 5405 5412 +7
Branches 1199 1202 +3
=======================================
+ Hits 5404 5411 +7
Misses 1 1
Continue to review full report at Codecov.
|
@dplewis any thoughts? I'm afraid of having counter effects with this change. @fastrde tests are also failing. Also, why don't you just use |
|
You can check here: https://travis-ci.com/github/parse-community/Parse-SDK-JS/jobs/442423259 There are lint issues and a failing test case. Talking about the pointers, I believe that's the expected behavior for referenced objects. To have them as pointers but with all data available. |
Can't reproduce the failing test on my local machine. (used the same commands that shown in the travis console)
to the pointers: when the objects are not saved, where should point the pointers to? When the objects are saved they have an Perhaps there are side effects I've overlooked. To make the change less scary it were a possibility to explicitly mark objects temporary (like the |
src/__tests__/encode-test.js
Outdated
@@ -17,6 +17,7 @@ const mockObject = function(className) { | |||
}; | |||
mockObject.registerSubclass = function() {}; | |||
mockObject.prototype = { | |||
id : 'objId123', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when i remove this line id
is undefined
and the new introduced if (value.id === undefined)
matches and the test encode ParseObjects
fails because the test expects a pointer. But this is exactly the case I want to treat differently. When there is no id
toPointer should not be called and the object should be send as full json.
● encode › encodes ParseObjects
Expected: "POINTER"
Received: {"__type": "Object", "className": "Item"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the test by setting an id within the test. The MockObject should closely resemble a real ParseObject.
Edit: Actually can you create an integration tests that shows |
…tcases for encoding of temporary objects
@dplewis you are right. The recursive encoding with toFullJSON runs in an endless loop when Now, after days of trying to get the tests working I know exactly what
means...
With this patches in place the encoding of temporary objects works and throws an error on circular encoding. The new integration test runs, but 4 other tests fail. This tests fail also when I patch the published parse version with the master branch of the sdk. |
That’s a cool workaround, we could add a way to inject the SDK instead of using the published version. I’ve been thinking about that for a while now. Currently we assume it works before merging it with the server. @davimacedo what do you think? |
Passing the Parse SDK to Parse Server via a configuration option makes sense to me. It looks that it could solve this problem and it would be helpful for other scenarios as well. In addition, the cross dependency between the projects makes maintenance harder and I believe that we should pursue to put the two projects together in the same mono repository. |
@fastrde @davimacedo Sorry for lack of feedback. I didn't realize that you have a check for circular cycles. Coincidently we need to check for cycles in transaction PR #1090 |
Converts the ParseObject
_toFullJson
when noid
is set. So you are able to send unsaved ParseObjects to the client to unify the communication when you retrieved the data previously from third party and are not allowed to save the data in your Parse-DB.see parse-community/parse-server#7004 for the complete discussion.