Bug report
**
Cannot resolve a reference to type 'Branch' with id: '2' unambigously, there are multiple candidates: /1, /user/branches/1
**
- [x ] I've checked documentation and searched for existing issues
- [ x] I've made sure my project is based on the latest MST version
- [ x] Fork this code sandbox or another minimal reproduction.
Sandbox link or minimal reproduction code
https://github.com/feluna/mobx-state-tree-bug-test
Describe the expected behavior
When we create a nested data model instance, all of its children should be attached to its parent.
When we destroy a node, all of its children should also be destroyed.
Describe the observed behavior
If we do not access a child node directly after it's been created, it never gets attached to its parent, therefore calling destroy on the parent node does not destroy those children. Later in the model's lifetime, the destroyed models might be created with the same data. In this case, the new created model contains the same data with some other dangling node.
I have included simple models, and a jest test case with comments to describe what i expect from the destroy call. I don't know if its the expected behavior of attaching to the parents or destroy calls, but i could not find any answers while searching the docs.
Bug report
**
**
Sandbox link or minimal reproduction code
https://github.com/feluna/mobx-state-tree-bug-test
Describe the expected behavior
When we create a nested data model instance, all of its children should be attached to its parent.
When we destroy a node, all of its children should also be destroyed.
Describe the observed behavior
If we do not access a child node directly after it's been created, it never gets attached to its parent, therefore calling destroy on the parent node does not destroy those children. Later in the model's lifetime, the destroyed models might be created with the same data. In this case, the new created model contains the same data with some other dangling node.
I have included simple models, and a jest test case with comments to describe what i expect from the destroy call. I don't know if its the expected behavior of attaching to the parents or destroy calls, but i could not find any answers while searching the docs.