You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to play with EJSON in the new 0.5.7 a bit, so I created a new meteor project and added the following bit of js. (I've deployed it on http://ejson-github-issue.meteor.com)
A click on the button sends a Dog object to the server, and the server sends a Dog object back.
What I see in the console on the client is:
cloning: A brown dog with stinky breath. ejson.js:20
typeName ejson.js:28
typeName ejson.js:28
serializing: A brown dog with stinky breath. ejson.js:32
[object Object] Object {fur: "brown", breath: "stinky"} ejson.js:9
And on the server:
parsing: { fur: 'brown', breath: 'stinky' }
Got: A brown dog with stinky breath.
cloning: A brown dog with stinky breath.
So when sending the Dog object from client to server, the object is first cloned, then serialized on the client, and then parsed on the server, and the method receives a proper Dog object.
But when sending the Dog object from server to client, only the cloning happens. typeName is never called, and serializing and parsing doesn't happen. So the clients receives a plain JSON object.
The text was updated successfully, but these errors were encountered:
Good catch! The bug appears to be in Meteor._stringifyDDP:
// adjust types to basic_.each(['fields','params','result'],function(field){if(_.has(copy,field))EJSON._adjustTypesToJSONValue(copy[field]);});
EJSON._adjustTypesToJSONValue doesn't actually work if copy[field] itself is an extended type (as opposed to an element inside it, which is what happens for fields and params).
I wanted to play with EJSON in the new 0.5.7 a bit, so I created a new meteor project and added the following bit of js. (I've deployed it on http://ejson-github-issue.meteor.com)
A click on the button sends a Dog object to the server, and the server sends a Dog object back.
What I see in the console on the client is:
And on the server:
So when sending the Dog object from client to server, the object is first cloned, then serialized on the client, and then parsed on the server, and the method receives a proper Dog object.
But when sending the Dog object from server to client, only the cloning happens.
typeName
is never called, and serializing and parsing doesn't happen. So the clients receives a plain JSON object.The text was updated successfully, but these errors were encountered: