payload: {"action":"closed","issue":{"url":"https://api.github.com/repos/feathers-plus/feathers-vuex/issues/237","repository_url":"https://api.github.com/repos/feathers-plus/feathers-vuex","labels_url":"https://api.github.com/repos/feathers-plus/feathers-vuex/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/feathers-plus/feathers-vuex/issues/237/comments","events_url":"https://api.github.com/repos/feathers-plus/feathers-vuex/issues/237/events","html_url":"https://github.com/feathers-plus/feathers-vuex/issues/237","id":469429581,"node_id":"MDU6SXNzdWU0Njk0Mjk1ODE=","number":237,"title":"diffOnPatch() clears all data for model instances","user":{"login":"morphatic","id":467980,"node_id":"MDQ6VXNlcjQ2Nzk4MA==","avatar_url":"https://avatars0.githubusercontent.com/u/467980?v=4","gravatar_id":"","url":"https://api.github.com/users/morphatic","html_url":"https://github.com/morphatic","followers_url":"https://api.github.com/users/morphatic/followers","following_url":"https://api.github.com/users/morphatic/following{/other_user}","gists_url":"https://api.github.com/users/morphatic/gists{/gist_id}","starred_url":"https://api.github.com/users/morphatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morphatic/subscriptions","organizations_url":"https://api.github.com/users/morphatic/orgs","repos_url":"https://api.github.com/users/morphatic/repos","events_url":"https://api.github.com/users/morphatic/events{/privacy}","received_events_url":"https://api.github.com/users/morphatic/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2019-07-17T20:30:43Z","updated_at":"2019-07-18T05:21:09Z","closed_at":"2019-07-18T05:21:09Z","author_association":"NONE","body":"### Steps to reproduce\r\n\r\n```js\r\n// 1. instantiate a model instance and save it\r\nconst { Todo } = this.$FeathersVuex.myApi\r\nconst todo = new Todo({ item: 'Write tests', done: false }).save()\r\n\r\n// 2. clone the instance and modify it\r\nconst clonedTodo = todo.clone()\r\nclonedTodo.done = true\r\n\r\n// 3. commit(?) and save the clone\r\nclonedTodo.commit() // I've tried commenting this line out, and I get the same result either way\r\nclonedTodo.save()\r\n\r\n// 4. check result\r\nif (todo.done) {\r\n  console.log('Yay! Expected result.')\r\n} else {\r\n  console.log('Boo. Actual result.')\r\n}\r\n```\r\n\r\nI did some digging and found that even though [`diffOnPatch()` in the v2.0.0-pre.62 codebase](https://github.com/feathers-plus/feathers-vuex/blob/v2.0.0-pre.62/src/service-module/make-model.ts#L57) is supposed to just return the submitted data by default, the built package has the following code (which appears to be a holdover from the previous version):\r\n\r\n```js\r\n// dist/service-module/service-module.actions.js#L169\r\n      if (diffOnPatch) {\r\n        var diff_1 = {}\r\n        deep_diff_1.observableDiff(state.copy, data, function(d) {\r\n          if (d.path && d.path.length) {\r\n            // Apply all changes except to the id property...\r\n            if (d.path[d.path.length - 1] !== idField) {\r\n              deep_diff_1.applyChange(diff_1, data, d)\r\n            }\r\n          }\r\n        })\r\n        data = diff_1\r\n      }\r\n```\r\n\r\nI threw a `console.log(data)` into the built module before and after the `if(diffOnPatch) {}` block and **before** the block it returned a `Todo` instance with my changes, but **after** the block, `data` had been converted to an empty object `{}` and therefore caused no changes in either the store or the API.\r\n\r\nAny ideas what's happening?\r\n\r\n- [x] Tell us what broke. The more detailed the better.\r\n- [ ] If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.\r\n\r\n### Expected behavior\r\n\r\nI'm expecting the changes to the model to get saved to the store **and** remote API.\r\n\r\n### Actual behavior\r\n\r\nChanges are not written to either the store or the API.\r\n\r\n### System configuration\r\n\r\nTell us about the applicable parts of your setup.\r\n\r\n**Module versions** (especially the part that's not working): v2.0.0-pre.62\r\n\r\n**NodeJS version**: v10.15.3\r\n\r\n**Operating System**: OSX 10.13.6 (High Sierra)\r\n\r\n**Browser Version**: Chrome (mac) 75.0.3770.100\r\n\r\n**Module Loader**: Vue v2.6.10, Vuex v3.1.1"}}
other: {"actor":{"display_login":"morphatic"}}