cerialize icon indicating copy to clipboard operation
cerialize copied to clipboard

Allow annotated only object analysis for Serialize

Open JasCodes opened this issue 8 years ago • 4 comments

Hey @weichx Plz chkout mbox lib for state management eg. https://jsfiddle.net/mweststrate/wv3yopo0/

If my object is mobx observer the Serialize fails due to

RangeError: Maximum call stack size exceeded

In debugging I found the whole object is being analysed even those properties which is not annotated to be Serialize/Deserialize.

I purpose you add an option which allow this behaviour.

Thx Jas

JasCodes avatar Jan 10 '17 10:01 JasCodes

@weichx Btw ur lib is awesome; specially Deserializeinto

JasCodes avatar Jan 10 '17 10:01 JasCodes

Glad you are liking the library! Happy to look at the issue, can provide a small sample of code that isn't working?

On Jan 10, 2017 11:02 AM, "Jaspreet Singh" [email protected] wrote:

Hey @weichx https://github.com/weichx Plz chkout mbox lib for state management eg. https://jsfiddle.net/mweststrate/wv3yopo0/

If my object is mobx observer the Serialize fails due to

RangeError: Maximum call stack size exceeded

In debugging I found the whole object is being analysed even those properties which is not annotated to be Serialize/Deserialize.

I purpose you add an option which allow this behaviour.

Thx Jas

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/weichx/cerialize/issues/45, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTXwfxxbv-1sKcbx8zjFLPQC1SqPZAPks5rQ1c7gaJpZM4LfOcO .

weichx avatar Jan 10 '17 14:01 weichx

class ClassA
{
  constructor(obj_b)
  {
    this.obj_b = obj_b  // not serialized but still analysed which cause cyclic error
  }
  @autoserialize var1=10
}

class ClassB
{
  @autoserialize var2=20
  @autoserialize a_obj = new ClassA(this)
}

b_obj= new ClassB()

Serialize(b_obj)

@weichx

JasCodes avatar Jan 10 '17 23:01 JasCodes

2 libs that implement cyclic operations :

https://github.com/erossignon/serialijse https://github.com/douglascrockford/JSON-js/blob/master/cycle.js

nicodmf avatar Mar 04 '18 08:03 nicodmf