-
Notifications
You must be signed in to change notification settings - Fork 66
Recalculation of async computed has incorrect context when using object form #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for finding this, I can look into it in ~ 2 weeks. |
The workaround seems to be fine for this. The clean solution would be to hide the editable $asyncComputed property completely and only expose the computed property. The same way all other properties should then only be exposed as computed properties, which avoids accidental assignments to those properties and solves the current problem that using asyncComputed hides the "data should be a function" warning I was planning to fix this last week, but due to other issues I need to postpone the fixes to around January 20. |
@michaelzangl looking forward to the fix, it would be very helpful for me. |
Fixed missing execution context during update function: Fixes #53
When an async computed property is created in the following way:
Calling
this.$asyncComputed.myProp.update()
will not set the proper context for the property to usethis
. Infact,this
will be undefined. IfasyncComputed
is a function instead of an object, it works.Here 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.You can see this example in action here:

The text was updated successfully, but these errors were encountered: