{"action":"created","issue":{"url":"https://api.github.com/repos/foxbenjaminfox/vue-async-computed/issues/53","repository_url":"https://api.github.com/repos/foxbenjaminfox/vue-async-computed","labels_url":"https://api.github.com/repos/foxbenjaminfox/vue-async-computed/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/foxbenjaminfox/vue-async-computed/issues/53/comments","events_url":"https://api.github.com/repos/foxbenjaminfox/vue-async-computed/issues/53/events","html_url":"https://github.com/foxbenjaminfox/vue-async-computed/issues/53","id":381158526,"node_id":"MDU6SXNzdWUzODExNTg1MjY=","number":53,"title":"Recalculation of async computed has incorrect context when using object form","user":{"login":"half2me","id":6759894,"node_id":"MDQ6VXNlcjY3NTk4OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/6759894?v=4","gravatar_id":"","url":"https://api.github.com/users/half2me","html_url":"https://github.com/half2me","followers_url":"https://api.github.com/users/half2me/followers","following_url":"https://api.github.com/users/half2me/following{/other_user}","gists_url":"https://api.github.com/users/half2me/gists{/gist_id}","starred_url":"https://api.github.com/users/half2me/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/half2me/subscriptions","organizations_url":"https://api.github.com/users/half2me/orgs","repos_url":"https://api.github.com/users/half2me/repos","events_url":"https://api.github.com/users/half2me/events{/privacy}","received_events_url":"https://api.github.com/users/half2me/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-15T13:22:20Z","updated_at":"2018-11-16T23:16:19Z","closed_at":null,"author_association":"NONE","body":"When an async computed property is created in the following way:\r\n```javascript\r\nasyncComputed: {\r\n  myProp: {\r\n    get() {},\r\n  },\r\n}\r\n```\r\nCalling `this.$asyncComputed.myProp.update()` will not set the proper context for the property to use `this`. Infact, `this` will be undefined. If `asyncComputed` is a function instead of an object, it works.\r\n\r\nHere is a simple example showing the problem. When the property is calculated automatically everything works as expected, but when manually triggering an `update()`, `this` is not defined.\r\n```javascript\r\n<template>\r\n  <div class=\"hello\">\r\n    <h1>{{ test }}</h1>\r\n    <button @click=\"recalc\">Recalculate</button>\r\n  </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n  name: \"HelloWorld\",\r\n  asyncComputed: {\r\n    test: {\r\n      get() {\r\n        return new Promise((resolve, reject) => {\r\n          setTimeout(() => resolve(this.msg), 1000);\r\n        });\r\n      },\r\n      default: \"calculating\"\r\n    }\r\n  },\r\n  data() {\r\n    return {\r\n      msg: \"Welcome to Your Vue.js App\"\r\n    };\r\n  },\r\n  methods: {\r\n    recalc() {\r\n      this.$asyncComputed.test.update();\r\n    }\r\n  }\r\n};\r\n</script>\r\n\r\n```\r\n\r\nYou can see this example in action here:\r\n[![Edit Vue Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/6xl7xp1y7w)"},"comment":{"url":"https://api.github.com/repos/foxbenjaminfox/vue-async-computed/issues/comments/439557696","html_url":"https://github.com/foxbenjaminfox/vue-async-computed/issues/53#issuecomment-439557696","issue_url":"https://api.github.com/repos/foxbenjaminfox/vue-async-computed/issues/53","id":439557696,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTU1NzY5Ng==","user":{"login":"michaelzangl","id":5981823,"node_id":"MDQ6VXNlcjU5ODE4MjM=","avatar_url":"https://avatars1.githubusercontent.com/u/5981823?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelzangl","html_url":"https://github.com/michaelzangl","followers_url":"https://api.github.com/users/michaelzangl/followers","following_url":"https://api.github.com/users/michaelzangl/following{/other_user}","gists_url":"https://api.github.com/users/michaelzangl/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelzangl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelzangl/subscriptions","organizations_url":"https://api.github.com/users/michaelzangl/orgs","repos_url":"https://api.github.com/users/michaelzangl/repos","events_url":"https://api.github.com/users/michaelzangl/events{/privacy}","received_events_url":"https://api.github.com/users/michaelzangl/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T23:16:19Z","updated_at":"2018-11-16T23:16:19Z","author_association":"CONTRIBUTOR","body":"Thanks for finding this, I can look into it in ~ 2 weeks."}}
{"actor":{"display_login":"michaelzangl"}}