mobxjs / serializr

Serialize and deserialize complex object graphs to and from JSON and Javascript classes
MIT License
766 stars 52 forks source link

Really struggling with circular dependencies #82

Closed robclouth closed 5 years ago

robclouth commented 6 years ago

Any tips? I tried putting all the createModelSchemas in a single file. Nope. Tried using a mix of @serializable and createModelSchema after the class defs. Nope. I'm pulling my hair out! I didn't even know circular deps in javascript was an issue until I started using serializr...

alexggordon commented 6 years ago

Can you give an example of what code is causing you an issue?

mweststrate commented 6 years ago

Here is some general guide on how to deal with circular deps in javascript modules: https://medium.com/visual-development/how-to-fix-nasty-circular-dependency-issues-once-and-for-all-in-javascript-typescript-a04c987cf0de

1R053 commented 5 years ago

generally, you'll have to use references - see e.g. the related question in #91