foxbenjaminfox/vue-async-computed

Issue updating reactive variables in asyncComputed

DidoMarchet opened this issue · 1 comments

Hi,
I've got an issues.
If I use reactive variables (such as this.$route.params) and I update them it crash.

Maybe I've done something wrong but this is what I do:

asyncComputed: {
    types: {
      async get() {
        const types = await getFilters('wines_tipology_aggregate',  this.$route.params)
        return types
      }
    },
}

This is the error I get

vue.runtime.esm.js?2b0e:619 [Vue warn]: Cannot set reactive property on undefined, null, or primitive value: undefined
Uncaught (in promise) TypeError: Cannot use 'in' operator to search for 'state' in undefined

If you have any suggestions to figure out this issues please tell me.
Thanks in advance and regards,

Davide

You're not doing anything wrong that I can see in that snippet of code; it should work.

Could it be that getFilters is the source of this error? Every time that this.$route.params changes, getFilters will be called with the arguments provided. Are you using in in getFilters in a way that might be the source of that error? (That is, it ends up trying to do 'state' in undefined.)

It does not seem to me that the root cause of this issue is in vue-async-computed, but if there is some other reason to think that it is, feel free to reopen this issue.