{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/falcor/issues/626","labels_url":"https://api.github.com/repos/Netflix/falcor/issues/626/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/falcor/issues/626/comments","events_url":"https://api.github.com/repos/Netflix/falcor/issues/626/events","html_url":"https://github.com/Netflix/falcor/issues/626","id":118191726,"number":626,"title":"Falcor subscribe not working as expected","user":{"login":"almasakchabayev","id":6459157,"avatar_url":"https://avatars.githubusercontent.com/u/6459157?v=3","gravatar_id":"","url":"https://api.github.com/users/almasakchabayev","html_url":"https://github.com/almasakchabayev","followers_url":"https://api.github.com/users/almasakchabayev/followers","following_url":"https://api.github.com/users/almasakchabayev/following{/other_user}","gists_url":"https://api.github.com/users/almasakchabayev/gists{/gist_id}","starred_url":"https://api.github.com/users/almasakchabayev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almasakchabayev/subscriptions","organizations_url":"https://api.github.com/users/almasakchabayev/orgs","repos_url":"https://api.github.com/users/almasakchabayev/repos","events_url":"https://api.github.com/users/almasakchabayev/events{/privacy}","received_events_url":"https://api.github.com/users/almasakchabayev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-11-21T11:48:02Z","updated_at":"2015-11-25T15:02:54Z","closed_at":null,"body":"Hello in the following example:\r\n```\r\nimport React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport falcor from 'falcor';\r\nimport _ from 'lodash';\r\n\r\nconst model = new falcor.Model({\r\n  cache: {\r\n    todos: [\r\n      {\r\n        text: 'check falcor',\r\n        completed: false,\r\n      },\r\n      {\r\n        text: 'do some codewar',\r\n        completed: false,\r\n      },\r\n      {\r\n        text: 'finish pluralsight',\r\n        completed: false,\r\n      }\r\n    ]\r\n  }\r\n});\r\n\r\nconst App = ({todos = [], addTodo}) => <div>\r\n  {_.values(todos).map((todo, index) => <TodoListItem todo={todo} index={index} />)}\r\n</div>;\r\n\r\nconst TodoListItem = ({todo, index}) => <div>\r\n  {todo.text} - {todo.completed.toString()}\r\n  <button onClick={e =>\r\n    model.setValue(`todos[${index}][\"completed\"]`, true).then(done => console.log(done))}\r\n  >Check as done</button>\r\n</div>;\r\n\r\nconst rootElement = document.createElement('div');\r\ndocument.body.appendChild(rootElement);\r\nvar eventStream = model.\r\n  get('todos[0..1][\"text\", \"completed\"]').\r\n  subscribe(data =>\r\n    ReactDOM.render(<App todos={data.json.todos} />, rootElement)\r\n  );\r\n```\r\n\r\nWhen I click a button `Check as done`  I see `true` being printed in console. I was then expecting that `model.get('todos[0..1][\"text\", \"completed\"]').` would emit new event with new data which would trigger `ReactDOM.render(<App todos={data.json.todos} />, rootElement)` to rerender the component with new data, however it does not happen. What am I misunderstanding"},"comment":{"url":"https://api.github.com/repos/Netflix/falcor/issues/comments/159634172","html_url":"https://github.com/Netflix/falcor/issues/626#issuecomment-159634172","issue_url":"https://api.github.com/repos/Netflix/falcor/issues/626","id":159634172,"user":{"login":"michaelbpaulson","id":4458174,"avatar_url":"https://avatars.githubusercontent.com/u/4458174?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelbpaulson","html_url":"https://github.com/michaelbpaulson","followers_url":"https://api.github.com/users/michaelbpaulson/followers","following_url":"https://api.github.com/users/michaelbpaulson/following{/other_user}","gists_url":"https://api.github.com/users/michaelbpaulson/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelbpaulson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelbpaulson/subscriptions","organizations_url":"https://api.github.com/users/michaelbpaulson/orgs","repos_url":"https://api.github.com/users/michaelbpaulson/repos","events_url":"https://api.github.com/users/michaelbpaulson/events{/privacy}","received_events_url":"https://api.github.com/users/michaelbpaulson/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T15:02:54Z","updated_at":"2015-11-25T15:02:54Z","body":"@almasakchabayev So this is very interesting... deref.  In master deref works _completely_ different than it does in latest npm.  In the npm version deref is not ergonomic, it _async_ resolves.\r\n\r\nHere is how master works:\r\n\r\n```javascript\r\nmodel.get([path, {to:9}, my, datum]).subscribe((x) => {\r\n    // Pass the point in the output in which you wish to deref to!\r\n    var pathModel = model.deref(x.json.path);\r\n});\r\n```\r\n\r\nCurrent deref (in npm) flips the notion of a get then deref to deref then get (which is less performant and ergonomic).\r\n\r\n```javascript\r\nmodel.\r\n    deref(\r\n        // Path to deref to\r\n        [path], \r\n        // leaf nodes, at least one needs to be included.\r\n        [{to:9}, my, datum]).\r\n    subscribe((pathModel) => {\r\n        // perform gets here\r\n        pathModel.get([{to: 9}, my, datom]).subscribe(...);\r\n    });\r\n```\r\n\r\nAs you can see master has much better integration with top down renderers (like react) and deref.  You get to use the output you generate to deref to that point in the graph.\r\n\r\nI hope that answers your questions."}}