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
Sorry for opening two tickets on pretty much the same thing ( #581 ), though I might have a possible solution. In this issue if an object has multiple references to the same object the value is cloned so the values are not the same.
Example:
// Sending side:letcommon_value=["This is a mutable object."]letobj={one: common_value,two: common_value}Object.is(obj.one,obj.two)// trueObject.is(obj.one,["This is a mutable object."])// falseconnection.send(obj)// Receiving side:connection.on('data',obj=>{// obj = { one: ["This is a mutable object."], two: ["This is a mutable object."] }Object.is(obj.one,obj.two)// falseObject.is(obj.one,["This is a mutable object."])// false})
As a solution I found dojox which would provide serialization to solve both this issue and issue #581.
The text was updated successfully, but these errors were encountered:
This is not a library issue, but you are missing the concept of pointers in JS, before sending, your obj.one and obj.two are pointers to common_value. Of course after sending them, they are resolved to their value before serializing them.
I don't think flatted work for this example neither.
What you should do instead is not to use Object.is but do a deep comparition.
Sorry for opening two tickets on pretty much the same thing ( #581 ), though I might have a possible solution. In this issue if an object has multiple references to the same object the value is cloned so the values are not the same.
Example:
As a solution I found dojox which would provide serialization to solve both this issue and issue #581.
The text was updated successfully, but these errors were encountered: