{"action":"created","issue":{"url":"https://api.github.com/repos/lytics/ember-data-model-fragments/issues/223","repository_url":"https://api.github.com/repos/lytics/ember-data-model-fragments","labels_url":"https://api.github.com/repos/lytics/ember-data-model-fragments/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/lytics/ember-data-model-fragments/issues/223/comments","events_url":"https://api.github.com/repos/lytics/ember-data-model-fragments/issues/223/events","html_url":"https://github.com/lytics/ember-data-model-fragments/issues/223","id":192202138,"number":223,"title":"Computed properties won't update on changes to nested model fragements","user":{"login":"benoror","id":119117,"avatar_url":"https://avatars.githubusercontent.com/u/119117?v=3","gravatar_id":"","url":"https://api.github.com/users/benoror","html_url":"https://github.com/benoror","followers_url":"https://api.github.com/users/benoror/followers","following_url":"https://api.github.com/users/benoror/following{/other_user}","gists_url":"https://api.github.com/users/benoror/gists{/gist_id}","starred_url":"https://api.github.com/users/benoror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoror/subscriptions","organizations_url":"https://api.github.com/users/benoror/orgs","repos_url":"https://api.github.com/users/benoror/repos","events_url":"https://api.github.com/users/benoror/events{/privacy}","received_events_url":"https://api.github.com/users/benoror/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-11-29T06:51:42Z","updated_at":"2016-12-21T11:07:18Z","closed_at":null,"body":"I have the following models:\r\n\r\n```javascript\r\n// app/models/user.js\r\nimport Model from 'ember-data/model';\r\nimport {\r\n  fragment\r\n} from 'model-fragments/attributes';\r\n\r\nexport default Model.extend({\r\n  family      : fragment('family')\r\n  // other attrs\r\n});\r\n```\r\n\r\n```javascript\r\n// app/models/family.js\r\nimport Model from 'ember-data/model';\r\nimport {\r\n  fragment\r\n} from 'model-fragments/attributes';\r\n\r\nexport default Model.extend({\r\n  spouse      : fragment('personal'),\r\n  mother      : fragment('personal'),\r\n  father      : fragment('personal')\r\n  // other attrs\r\n});\r\n```\r\n\r\n```javascript\r\n// app/models/personal.js\r\nimport attr from 'ember-data/attr';\r\nimport Fragment from 'model-fragments/fragment';\r\n\r\nexport default Fragment.extend({\r\n  firstName : attr('string'),\r\n  lastName  : attr('string'),\r\n  activeInsurance  : attr() // This is not 'boolean' as it can be three-state: null, true & false\r\n});\r\n```\r\n\r\nIf I have an instance of the `user.family` model (let's say passed into a component), and I have a computed property which observes that model, cached result of the computed property won't be updated when the nested fragments data is changed:\r\n\r\n```javascript\r\n// This computed property won't react to changes on any family member\r\nallFamilyHasInsurance: computed('myUser.family', function() {\r\n  //...\r\n}),\r\n```"},"comment":{"url":"https://api.github.com/repos/lytics/ember-data-model-fragments/issues/comments/268496521","html_url":"https://github.com/lytics/ember-data-model-fragments/issues/223#issuecomment-268496521","issue_url":"https://api.github.com/repos/lytics/ember-data-model-fragments/issues/223","id":268496521,"user":{"login":"douglascofferi","id":15314650,"avatar_url":"https://avatars.githubusercontent.com/u/15314650?v=3","gravatar_id":"","url":"https://api.github.com/users/douglascofferi","html_url":"https://github.com/douglascofferi","followers_url":"https://api.github.com/users/douglascofferi/followers","following_url":"https://api.github.com/users/douglascofferi/following{/other_user}","gists_url":"https://api.github.com/users/douglascofferi/gists{/gist_id}","starred_url":"https://api.github.com/users/douglascofferi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/douglascofferi/subscriptions","organizations_url":"https://api.github.com/users/douglascofferi/orgs","repos_url":"https://api.github.com/users/douglascofferi/repos","events_url":"https://api.github.com/users/douglascofferi/events{/privacy}","received_events_url":"https://api.github.com/users/douglascofferi/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T11:07:18Z","updated_at":"2016-12-21T11:07:18Z","body":"@jakesjews yes bro, i have the following models:\r\n\r\n`// app/models/justice.js\r\nimport { fragment, fragmentArray, array } from 'model-fragments/attributes';\r\nimport Model from 'ember-data/model';\r\nimport attr from 'ember-data/attr';\r\nimport ValidationJustice from 'adv2c/validations/justice';\r\n\r\nexport default Model.extend(ValidationJustice, {\r\n  judgment: fragment('justice/judgment'),\r\n  // other attrs\r\n});`\r\n\r\n`// app/models/justice/judgment.js\r\nimport attr from 'ember-data/attr';\r\nimport Fragment from 'model-fragments/fragment';\r\n\r\nexport default Fragment.extend({\r\n  // other attrs\r\n  courtName: attr('string'),\r\n\r\n  courtName: Ember.computed('number', function() {\r\n    console.log(`${this.get('courtName')}`);\r\n    return `${this.get('courtName')}`;\r\n  }),\r\n  //or with observer also does not work\r\n  courtNameChanged: Ember.observer('courtName', function() {\r\n    console.log(`courtName changed to: ${this.get('courtName')}`);\r\n  })\r\n\r\n});`\r\n\r\nThank you man!"}}
{"actor":{"display_login":"douglascofferi"}}