{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/immutable-js/issues/493","labels_url":"https://api.github.com/repos/facebook/immutable-js/issues/493/labels{/name}","comments_url":"https://api.github.com/repos/facebook/immutable-js/issues/493/comments","events_url":"https://api.github.com/repos/facebook/immutable-js/issues/493/events","html_url":"https://github.com/facebook/immutable-js/issues/493","id":85594687,"number":493,"title":"Question on the correct way of updating nested Maps in Lists","user":{"login":"Robert-W","id":1177959,"avatar_url":"https://avatars.githubusercontent.com/u/1177959?v=3","gravatar_id":"","url":"https://api.github.com/users/Robert-W","html_url":"https://github.com/Robert-W","followers_url":"https://api.github.com/users/Robert-W/followers","following_url":"https://api.github.com/users/Robert-W/following{/other_user}","gists_url":"https://api.github.com/users/Robert-W/gists{/gist_id}","starred_url":"https://api.github.com/users/Robert-W/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Robert-W/subscriptions","organizations_url":"https://api.github.com/users/Robert-W/orgs","repos_url":"https://api.github.com/users/Robert-W/repos","events_url":"https://api.github.com/users/Robert-W/events{/privacy}","received_events_url":"https://api.github.com/users/Robert-W/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-05T18:05:25Z","updated_at":"2015-06-05T22:42:50Z","closed_at":null,"body":"I want to update one of my components to use Immutable.js and was curious the best way to update nested Maps.  I have a relatively simple data structure with nested objects and children and it could potentially go very deep.  It is a json structure used for a Tree component.  The data looks like this:\r\n\r\n<pre><code>\r\n[\r\n  {id:'A', label: 'A', checked: true},\r\n  {id:'B',label: 'B'},\r\n  {id:'C',label: 'C',\r\n    children: [\r\n        {id:'C-A',label: 'C-A'},\r\n        {id:'C-B',label: 'C-B', checked: true},\r\n        {id:'C-C',label: 'C-C',\r\n          children: [\r\n              {id:'C-C-A',label: 'C-C-A'},\r\n              {id:'C-C-B',label: 'C-C-B'},\r\n              {id:'C-C-C',label: 'C-C-C', checked: true}\r\n          ]\r\n        }\r\n    ]\r\n  },\r\n  {id:'D',label: 'D'}\r\n]\r\n</code></pre>\r\n\r\nThis is a controlled component and so when the user interacts with the tree, I update the appropriate checked value in the data with the corresponding id.  So for example, I may change the checked attribute from true to false for the node with id 'C-C-C'.  I am attaching a link of a JSFiddle that I used and it works but I am not sure if the same can be achieved in a better way using setIn or something.\r\n\r\nJSFiddle link: http://jsfiddle.net/yk2y2hhu/1/"},"comment":{"url":"https://api.github.com/repos/facebook/immutable-js/issues/comments/109468741","html_url":"https://github.com/facebook/immutable-js/issues/493#issuecomment-109468741","issue_url":"https://api.github.com/repos/facebook/immutable-js/issues/493","id":109468741,"user":{"login":"kentor","id":240493,"avatar_url":"https://avatars.githubusercontent.com/u/240493?v=3","gravatar_id":"","url":"https://api.github.com/users/kentor","html_url":"https://github.com/kentor","followers_url":"https://api.github.com/users/kentor/followers","following_url":"https://api.github.com/users/kentor/following{/other_user}","gists_url":"https://api.github.com/users/kentor/gists{/gist_id}","starred_url":"https://api.github.com/users/kentor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentor/subscriptions","organizations_url":"https://api.github.com/users/kentor/orgs","repos_url":"https://api.github.com/users/kentor/repos","events_url":"https://api.github.com/users/kentor/events{/privacy}","received_events_url":"https://api.github.com/users/kentor/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T22:42:50Z","updated_at":"2015-06-05T22:42:50Z","body":"The value of 'C' is a plain object, not another immutable structure, i.e. `data.getIn(['C', 'children']) === undefined`\r\n\r\nIf you have a nested object that you want to convert to a Map use `Immutable.fromJS`, https://github.com/facebook/immutable-js#nested-structures"}}