{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/store/issues/69","repository_url":"https://api.github.com/repos/aurelia/store","labels_url":"https://api.github.com/repos/aurelia/store/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/store/issues/69/comments","events_url":"https://api.github.com/repos/aurelia/store/issues/69/events","html_url":"https://github.com/aurelia/store/issues/69","id":366808298,"node_id":"MDU6SXNzdWUzNjY4MDgyOTg=","number":69,"title":"Call the changedHandler after the value has been set","user":{"login":"Kennethtruyers","id":4473300,"node_id":"MDQ6VXNlcjQ0NzMzMDA=","avatar_url":"https://avatars0.githubusercontent.com/u/4473300?v=4","gravatar_id":"","url":"https://api.github.com/users/Kennethtruyers","html_url":"https://github.com/Kennethtruyers","followers_url":"https://api.github.com/users/Kennethtruyers/followers","following_url":"https://api.github.com/users/Kennethtruyers/following{/other_user}","gists_url":"https://api.github.com/users/Kennethtruyers/gists{/gist_id}","starred_url":"https://api.github.com/users/Kennethtruyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kennethtruyers/subscriptions","organizations_url":"https://api.github.com/users/Kennethtruyers/orgs","repos_url":"https://api.github.com/users/Kennethtruyers/repos","events_url":"https://api.github.com/users/Kennethtruyers/events{/privacy}","received_events_url":"https://api.github.com/users/Kennethtruyers/received_events","type":"User","site_admin":false},"labels":[{"id":756338279,"node_id":"MDU6TGFiZWw3NTYzMzgyNzk=","url":"https://api.github.com/repos/aurelia/store/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-04T14:07:34Z","updated_at":"2018-10-26T03:10:10Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nBUGS: Please use this template.\r\n\r\nSUPPORT REQUESTS/QUESTIONS: If you have a support request or question please\r\nsubmit them to StackOverflow using the tag `[aurelia]`\r\nhttp://stackoverflow.com/questions/tagged/aurelia\r\nor the Aurelia Gitter https://gitter.im/aurelia/discuss\r\n\r\nBlue Spire offers paid support agreements. Further information regarding paid support\r\nmay be obtained by emailing support@bluespire.com\r\n\r\nFuture support requests submitted here will be closed.\r\n\r\nThe HTML comments below are for your reference, and are not displayed\r\nwhen your issue is submitted, feel free to leave them.\r\n\r\nChoose one of the two headings, delete the other.\r\n-->\r\n**I'm submitting a feature request**\r\n\r\n* **Library Version:**\r\n1.1.0\r\n\r\n**Please tell us about your environment:**\r\n* **Operating System:**\r\nall\r\n\r\n* **Node Version:**\r\nall\r\n<!--\r\nMinimum supported Node version is latest Node 4.x LTS\r\nrun `node -v`\r\n-->\r\n\r\n* **NPM Version:**\r\nall\r\n<!--\r\nMinimum supported NPM version is 3.x\r\nrun `npm -v`\r\n-->\r\n\r\n* **JSPM OR Webpack AND Version**\r\nboth\r\n<!--\r\nIf using JSPM\r\nrun `jspm -v`\r\nIf using Webpack\r\nrun `webpack --help | grep webpack`\r\n-->\r\n\r\n* **Browser:**\r\nall\r\n\r\n* **Language:**\r\nall\r\n\r\n\r\n**Current behavior:**\r\nWhenever we subscribe to a part of the state, the changed handler will be called before the actual state is changed. \r\n\r\n```\r\n@autoinject()\r\n@connectTo({\r\n  selector: {\r\n    list: store => store.state.pipe(pluck('list'))\r\n  }\r\n})\r\nexport class App {\r\n  store;\r\n  list : string[] = [];\r\n  normalBinding : string;\r\n\r\n  constructor(store : Store<any>) {\r\n    this.store = store;\r\n    this.store.registerAction('addList', addList);\r\n  }\r\n\r\n  listChanged(newValue, oldValue) {\r\n    // this.list does not have the newValue yet, in contrast with normal \r\n    // aurelia behavior where this.list would have the value when this handler is called\r\n  }\r\n\r\n   normalBindingChanged(newValue, oldValue){\r\n     // this.normalBinding is already set at this moment\r\n   }\r\n  }\r\n}\r\n```\r\n\r\n* **What is the expected behavior?**\r\nThe bound value should be set before the changed-handler is invoked\r\n\r\n* **What is the motivation / use case for changing the behavior?**\r\nIt aligns better with the default Aurelia behavior and meets the expectations of users better"},"comment":{"url":"https://api.github.com/repos/aurelia/store/issues/comments/433272195","html_url":"https://github.com/aurelia/store/issues/69#issuecomment-433272195","issue_url":"https://api.github.com/repos/aurelia/store/issues/69","id":433272195,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzI3MjE5NQ==","user":{"login":"Vheissu","id":368330,"node_id":"MDQ6VXNlcjM2ODMzMA==","avatar_url":"https://avatars0.githubusercontent.com/u/368330?v=4","gravatar_id":"","url":"https://api.github.com/users/Vheissu","html_url":"https://github.com/Vheissu","followers_url":"https://api.github.com/users/Vheissu/followers","following_url":"https://api.github.com/users/Vheissu/following{/other_user}","gists_url":"https://api.github.com/users/Vheissu/gists{/gist_id}","starred_url":"https://api.github.com/users/Vheissu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vheissu/subscriptions","organizations_url":"https://api.github.com/users/Vheissu/orgs","repos_url":"https://api.github.com/users/Vheissu/repos","events_url":"https://api.github.com/users/Vheissu/events{/privacy}","received_events_url":"https://api.github.com/users/Vheissu/received_events","type":"User","site_admin":false},"created_at":"2018-10-26T03:10:10Z","updated_at":"2018-10-26T03:10:10Z","author_association":"MEMBER","body":"This issue is related to the fact that the `connectTo` decorator attaches subscriptions inside of `bind` and `unbind` but I've found sometimes this is too late and you get the problem you speak of. I find if I setup a subscription inside of the `constructor` itself then I don't run into these issues where the value is unavailable. It's a decent workaround.\r\n\r\nNot sure if your provided code was just a non-function example, but your `list` property is not an `observable` so Aurelia won't call `listChanged` because it is not observing the property. Although, you might know this already."}}
{"actor":{"display_login":"Vheissu"}}