{"action":"closed","issue":{"url":"https://api.github.com/repos/canjs/canjs/issues/2434","repository_url":"https://api.github.com/repos/canjs/canjs","labels_url":"https://api.github.com/repos/canjs/canjs/issues/2434/labels{/name}","comments_url":"https://api.github.com/repos/canjs/canjs/issues/2434/comments","events_url":"https://api.github.com/repos/canjs/canjs/issues/2434/events","html_url":"https://github.com/canjs/canjs/issues/2434","id":165115409,"number":2434,"title":"Live/Two-way binding with nested components","user":{"login":"Macrofig","id":2633542,"avatar_url":"https://avatars.githubusercontent.com/u/2633542?v=3","gravatar_id":"","url":"https://api.github.com/users/Macrofig","html_url":"https://github.com/Macrofig","followers_url":"https://api.github.com/users/Macrofig/followers","following_url":"https://api.github.com/users/Macrofig/following{/other_user}","gists_url":"https://api.github.com/users/Macrofig/gists{/gist_id}","starred_url":"https://api.github.com/users/Macrofig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Macrofig/subscriptions","organizations_url":"https://api.github.com/users/Macrofig/orgs","repos_url":"https://api.github.com/users/Macrofig/repos","events_url":"https://api.github.com/users/Macrofig/events{/privacy}","received_events_url":"https://api.github.com/users/Macrofig/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-12T15:55:58Z","updated_at":"2016-07-12T17:00:50Z","closed_at":null,"body":"I posted a question in [Gitter](https://gitter.im/canjs/canjs?at=5783edcc1ca34a944ef2891a) regarding live-binding between multiple nested components.  It seems that binding a boolean value travels all the way down but does not update back up.\r\n\r\n## Setup\r\n\r\nSo, this is my main template:\r\n\r\n```mustache\r\n<button type=\"button\" can-click=\"triggerReload\">Reload</button>\r\n<main-component reload=\"{reload}\"></main-component>\r\n```\r\n\r\nThe `main-component`'s template looks like...\r\n\r\n```mustache\r\n<sub-component reload=\"{reload}\"></sub-component>\r\n```\r\n\r\nBy clicking on the `Reload` button, we update the `reload` property to `true`. This should travel all the way down to `sub-component` which fetches its own data. When the data is retrieved, `sub-component` should set `reload` back to `false` so we can re-fetch data again in the future.\r\n\r\n> I have a workaround that I can use for the time being. But I should mention that I don't recommend component's fetching their own data. Unfortunately, we're kinda stuck with this for now.\r\n\r\n## Problem\r\n\r\nUsing the latest CanJS, changing the property from above will update down. But when the sub-component updates the value, the change does not propagate back up to the top.\r\n\r\nThanks to @web-mech for explaining that it could be that live-binding to primitives doesn't really work. Although, my understanding is that CanJS would wrap these values in a compute so it *should* work. But I could be wrong.\r\n\r\nFurthermore, in using the workaround, I found out that my sub-component cannot be the one to define an object; it must be defined by the top most component. This makes sense-ish. Except for this: https://canjs.com/docs/can.view.bindings.twoWay.html#section_Initialization Maybe I misunderstood what should happen when the parent is undefined but the child is defined?\r\n\r\n## JSBin Links\r\n\r\n- Latest [broken]: http://jsbin.com/joyofu/edit?html,js,output\r\n- Latest, Workaround [works]: http://jsbin.com/bamapo/1/edit?html,js,output\r\n- Latest, workaround, sub-component define [broken]: http://jsbin.com/cuzavu/edit?html,js,output\r\n- Latest, new binding syntax [broken]: http://jsbin.com/qamada/1/edit?html,js,output\r\n- 2.2.9 [REALLY broken]:  http://jsbin.com/ninibot/2/edit?js,output"}}
{"actor":{"display_login":"justinbmeyer"}}