{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/binding/issues/713","repository_url":"https://api.github.com/repos/aurelia/binding","labels_url":"https://api.github.com/repos/aurelia/binding/issues/713/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/binding/issues/713/comments","events_url":"https://api.github.com/repos/aurelia/binding/issues/713/events","html_url":"https://github.com/aurelia/binding/issues/713","id":360074901,"node_id":"MDU6SXNzdWUzNjAwNzQ5MDE=","number":713,"title":"One-Way adds 'undefined' property value on object with no properties","user":{"login":"jmzagorski","id":8404957,"node_id":"MDQ6VXNlcjg0MDQ5NTc=","avatar_url":"https://avatars2.githubusercontent.com/u/8404957?v=4","gravatar_id":"","url":"https://api.github.com/users/jmzagorski","html_url":"https://github.com/jmzagorski","followers_url":"https://api.github.com/users/jmzagorski/followers","following_url":"https://api.github.com/users/jmzagorski/following{/other_user}","gists_url":"https://api.github.com/users/jmzagorski/gists{/gist_id}","starred_url":"https://api.github.com/users/jmzagorski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmzagorski/subscriptions","organizations_url":"https://api.github.com/users/jmzagorski/orgs","repos_url":"https://api.github.com/users/jmzagorski/repos","events_url":"https://api.github.com/users/jmzagorski/events{/privacy}","received_events_url":"https://api.github.com/users/jmzagorski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-13T21:34:33Z","updated_at":"2018-09-14T13:05:45Z","closed_at":null,"author_association":"NONE","body":"**I'm submitting a bug report**\r\nAlthough I am sure this is the expected behavior and my scenario might be an edge case.\r\n\r\n* **Library Version:**\r\n1.6.0 (aurelia-framework 1.2)\r\n\r\n\r\n**Please tell us about your environment:**\r\n* **Operating System:**\r\nWindows 10\r\n\r\n* **Node Version:**\r\nv8.9.4\r\n\r\n* **NPM Version:**\r\n6.3.0\r\n\r\n* **JSPM OR Webpack AND Version**\r\nwebpack 3.12.0\r\n\r\n* **Browser:**\r\nall\r\n\r\n* **Language:**\r\nall\r\n\r\n**Current behavior:**\r\nWhen using `one-way` binding on an objects property in a view, that property is added to the object with a value an `undefined` when that object is created without any properties, which makes it feel like the view is updating my model (aka `two-way`).  See https://stackblitz.com/edit/aurelia-javascript-qekbtf?embed=1&file=src/app.js for an example.\r\n\r\nThe `undefined` value gets added [here](https://github.com/aurelia/binding/blob/a680c7203e850ea37b4e1147365d2c0a07e94968/src/connectable-binding.js#L26) \r\n\r\n\r\n**Expected/desired behavior:**\r\n\r\n\r\n* **What is the expected behavior?**\r\nNo property is added the object if it does not exist and the value is undefined\r\n\r\n* **What is the motivation / use case for changing the behavior?**\r\nUsing the example I provided: When `canDeactivate` runs I compare the initial `foo` to the current `foo` so I can warn users of any unsaved changes before navigating away. I not only compare property values, but property count too (i am using lodash.isequal). However, when a user goes to a view model and does nothing, then tries to navigate away, they receive my warning because the properties in the view have been added to my empty object. There are many ways I can work around this, and I have done that in my app. However, in my example I am using redux so i am expecting all state mutations to come from my reducer. There might not be a solution, but I wanted to address this before I moved on since it bothered me that something outside of my reducer was changing my object and that the change originated from the view in `one-way` binding."},"comment":{"url":"https://api.github.com/repos/aurelia/binding/issues/comments/421352195","html_url":"https://github.com/aurelia/binding/issues/713#issuecomment-421352195","issue_url":"https://api.github.com/repos/aurelia/binding/issues/713","id":421352195,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTM1MjE5NQ==","user":{"login":"bigopon","id":9994529,"node_id":"MDQ6VXNlcjk5OTQ1Mjk=","avatar_url":"https://avatars0.githubusercontent.com/u/9994529?v=4","gravatar_id":"","url":"https://api.github.com/users/bigopon","html_url":"https://github.com/bigopon","followers_url":"https://api.github.com/users/bigopon/followers","following_url":"https://api.github.com/users/bigopon/following{/other_user}","gists_url":"https://api.github.com/users/bigopon/gists{/gist_id}","starred_url":"https://api.github.com/users/bigopon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigopon/subscriptions","organizations_url":"https://api.github.com/users/bigopon/orgs","repos_url":"https://api.github.com/users/bigopon/repos","events_url":"https://api.github.com/users/bigopon/events{/privacy}","received_events_url":"https://api.github.com/users/bigopon/received_events","type":"User","site_admin":false},"created_at":"2018-09-14T13:05:45Z","updated_at":"2018-09-14T13:05:45Z","author_association":"MEMBER","body":"The documentation part could always use some help. At the moment, `how it works` section (https://aurelia.io/docs/binding/how-it-works) covers high level perspective and is lacking part like this. Would be nice if you could help add some more 😉 "}}
{"actor":{"display_login":"bigopon"}}