{"action":"created","issue":{"url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1080","repository_url":"https://api.github.com/repos/mobxjs/mobx-state-tree","labels_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1080/labels{/name}","comments_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1080/comments","events_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1080/events","html_url":"https://github.com/mobxjs/mobx-state-tree/issues/1080","id":381911661,"node_id":"MDU6SXNzdWUzODE5MTE2NjE=","number":1080,"title":"Destroying a model with not accessed children results in dangling nodes","user":{"login":"feluna","id":1093695,"node_id":"MDQ6VXNlcjEwOTM2OTU=","avatar_url":"https://avatars1.githubusercontent.com/u/1093695?v=4","gravatar_id":"","url":"https://api.github.com/users/feluna","html_url":"https://github.com/feluna","followers_url":"https://api.github.com/users/feluna/followers","following_url":"https://api.github.com/users/feluna/following{/other_user}","gists_url":"https://api.github.com/users/feluna/gists{/gist_id}","starred_url":"https://api.github.com/users/feluna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feluna/subscriptions","organizations_url":"https://api.github.com/users/feluna/orgs","repos_url":"https://api.github.com/users/feluna/repos","events_url":"https://api.github.com/users/feluna/events{/privacy}","received_events_url":"https://api.github.com/users/feluna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-17T23:32:41Z","updated_at":"2018-11-18T00:25:51Z","closed_at":null,"author_association":"NONE","body":"<!-- Not following the template might result in your issue being closed without further notice -->\r\n\r\n**_Bug report_**\r\n\r\n **\r\n\r\n> Cannot resolve a reference to type 'Branch' with id: '2' unambigously, there are multiple candidates: /1, /user/branches/1\r\n\r\n**\r\n\r\n* [x ] I've checked documentation and searched for existing issues\r\n* [ x] I've made sure my project is based on the latest MST version\r\n* [ x] Fork [this](https://codesandbox.io/s/y64pzxj01) code sandbox or another minimal reproduction. \r\n\r\n\r\n\r\n**Sandbox link or minimal reproduction code**\r\n<!-- link to your sandbox or alternatively minimal reproduction code-->\r\nhttps://github.com/feluna/mobx-state-tree-bug-test\r\n\r\n**Describe the expected behavior**\r\n<!-- What should happen? -->\r\nWhen we create a nested data model instance, all of its children should be attached to its parent. \r\nWhen we destroy a node, all of its children should also be destroyed. \r\n\r\n**Describe the observed behavior**\r\n<!-- What happens instead? -->\r\nIf 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.\r\n\r\nI 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. "},"comment":{"url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/comments/439657807","html_url":"https://github.com/mobxjs/mobx-state-tree/issues/1080#issuecomment-439657807","issue_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/1080","id":439657807,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTY1NzgwNw==","user":{"login":"xaviergonz","id":6306796,"node_id":"MDQ6VXNlcjYzMDY3OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/6306796?v=4","gravatar_id":"","url":"https://api.github.com/users/xaviergonz","html_url":"https://github.com/xaviergonz","followers_url":"https://api.github.com/users/xaviergonz/followers","following_url":"https://api.github.com/users/xaviergonz/following{/other_user}","gists_url":"https://api.github.com/users/xaviergonz/gists{/gist_id}","starred_url":"https://api.github.com/users/xaviergonz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xaviergonz/subscriptions","organizations_url":"https://api.github.com/users/xaviergonz/orgs","repos_url":"https://api.github.com/users/xaviergonz/repos","events_url":"https://api.github.com/users/xaviergonz/events{/privacy}","received_events_url":"https://api.github.com/users/xaviergonz/received_events","type":"User","site_admin":false},"created_at":"2018-11-18T00:25:51Z","updated_at":"2018-11-18T00:25:51Z","author_association":"CONTRIBUTOR","body":"Cc @k-g-a"}}
{"actor":{"display_login":"xaviergonz"}}