-
Hello, I need to get a snapshot of a model to send to a backend, I use getSnapshot that works great but it not resolve references. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hi @Ziltosh! Could you elaborate a bit on what you mean by "resolved references", and maybe give an example? I don't quite follow. Do you mean that the snapshot should look more like |
Beta Was this translation helpful? Give feedback.
-
Hi, Yes, I would like to be able to recover the entire object and not only reference id, but I don't know how. Here is a simple example: https://codesandbox.io/s/clever-currying-9qi28d?file=/src/index.ts |
Beta Was this translation helpful? Give feedback.
-
You can use the Note that it won't work in your current example becuase the reference needs to be resolvable from the same tree. |
Beta Was this translation helpful? Give feedback.
-
Oh, thank you 👍 . |
Beta Was this translation helpful? Give feedback.
You can use the
toJS
utility method from mobx: https://mobx.js.org/api.html#tojsNote that it won't work in your current example becuase the reference needs to be resolvable from the same tree.