{"action":"created","issue":{"url":"https://api.github.com/repos/WP-API/client-js/issues/132","repository_url":"https://api.github.com/repos/WP-API/client-js","labels_url":"https://api.github.com/repos/WP-API/client-js/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/WP-API/client-js/issues/132/comments","events_url":"https://api.github.com/repos/WP-API/client-js/issues/132/events","html_url":"https://github.com/WP-API/client-js/issues/132","id":169832278,"number":132,"title":"Backbone Model structure differences in fetch and save","user":{"login":"JasonTheAdams","id":2024145,"avatar_url":"https://avatars.githubusercontent.com/u/2024145?v=3","gravatar_id":"","url":"https://api.github.com/users/JasonTheAdams","html_url":"https://github.com/JasonTheAdams","followers_url":"https://api.github.com/users/JasonTheAdams/followers","following_url":"https://api.github.com/users/JasonTheAdams/following{/other_user}","gists_url":"https://api.github.com/users/JasonTheAdams/gists{/gist_id}","starred_url":"https://api.github.com/users/JasonTheAdams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JasonTheAdams/subscriptions","organizations_url":"https://api.github.com/users/JasonTheAdams/orgs","repos_url":"https://api.github.com/users/JasonTheAdams/repos","events_url":"https://api.github.com/users/JasonTheAdams/events{/privacy}","received_events_url":"https://api.github.com/users/JasonTheAdams/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-08T02:27:25Z","updated_at":"2016-08-10T22:51:48Z","closed_at":"2016-08-10T22:51:48Z","body":"As I work more and more with the JS client, I find that it's pretty awkward how things like content/title change depending on whether they're being saved versus fetched. The title, for example, is fetched as an object with raw and rendered properties. On the other hand, when saved it's supposed to be a string.\r\n\r\nEspecially when taking advantage of collection and model events, the structure of the model isn't reliable. I'm changing the title in one area when the title updates in the model. Since the `'change:title'` event triggers both when the model is synced or when `model.set('title')` is called, I end up needing the following:\r\n\r\n```\r\ntitleChanged: function() {\r\n  var title = this.model.get('title');\r\n  if ( 'string' === typeof title ) {\r\n    this.$el.find('.lv-title').text(title);\r\n  }\r\n},\r\n```\r\n\r\nNot the end of the world, but it definitely made me wonder about the importance of consistency in the model structure. Doesn't seem like a particularly reliable model if it changes depending on which way it's headed.\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/WP-API/client-js/issues/comments/239028982","html_url":"https://github.com/WP-API/client-js/issues/132#issuecomment-239028982","issue_url":"https://api.github.com/repos/WP-API/client-js/issues/132","id":239028982,"user":{"login":"JasonTheAdams","id":2024145,"avatar_url":"https://avatars.githubusercontent.com/u/2024145?v=3","gravatar_id":"","url":"https://api.github.com/users/JasonTheAdams","html_url":"https://github.com/JasonTheAdams","followers_url":"https://api.github.com/users/JasonTheAdams/followers","following_url":"https://api.github.com/users/JasonTheAdams/following{/other_user}","gists_url":"https://api.github.com/users/JasonTheAdams/gists{/gist_id}","starred_url":"https://api.github.com/users/JasonTheAdams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JasonTheAdams/subscriptions","organizations_url":"https://api.github.com/users/JasonTheAdams/orgs","repos_url":"https://api.github.com/users/JasonTheAdams/repos","events_url":"https://api.github.com/users/JasonTheAdams/events{/privacy}","received_events_url":"https://api.github.com/users/JasonTheAdams/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T22:51:48Z","updated_at":"2016-08-10T22:51:48Z","body":"Moved this back to WP-API."}}
{"actor":{"display_login":"JasonTheAdams"}}