{"action":"opened","issue":{"url":"https://api.github.com/repos/behavior3/behavior3editor/issues/5","labels_url":"https://api.github.com/repos/behavior3/behavior3editor/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/behavior3/behavior3editor/issues/5/comments","events_url":"https://api.github.com/repos/behavior3/behavior3editor/issues/5/events","html_url":"https://github.com/behavior3/behavior3editor/issues/5","id":106011183,"number":5,"title":"Unable to open project with nested trees","user":{"login":"closeratio","id":787828,"avatar_url":"https://avatars.githubusercontent.com/u/787828?v=3","gravatar_id":"","url":"https://api.github.com/users/closeratio","html_url":"https://github.com/closeratio","followers_url":"https://api.github.com/users/closeratio/followers","following_url":"https://api.github.com/users/closeratio/following{/other_user}","gists_url":"https://api.github.com/users/closeratio/gists{/gist_id}","starred_url":"https://api.github.com/users/closeratio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/closeratio/subscriptions","organizations_url":"https://api.github.com/users/closeratio/orgs","repos_url":"https://api.github.com/users/closeratio/repos","events_url":"https://api.github.com/users/closeratio/events{/privacy}","received_events_url":"https://api.github.com/users/closeratio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-11T13:28:51Z","updated_at":"2015-09-11T13:28:51Z","closed_at":null,"body":"If I have a project where a tree references another tree that is **below** it in the list on the left of the editor, I save the project, and then attempt to reopen it, the editor fails with an error message.\r\n\r\nAfter taking a bit of a look at the source, this appears to be because the trees in the serialised JSON are stored in an array, and if a tree refers to a nested tree which exists **after** it in said array, it won't have added it within the NodeManager, and hence will fail.\r\n\r\nI would either suggest changing the JSON format so that the trees are stored as key-value pairs (much like the nodes), or having an additional processing phase before attempting to load the tree, so that the node manager is aware of all the nodes that exist within the project file. The latter approach wouldn't invalidate existing projects files, and is probably the preferred one from my point of view."}}