Subscribing to property of computed property
lwansbrough opened this issue · 1 comments
lwansbrough commented
I have the following scenario:
export default {
name: 'Test',
subscriptions () {
return {
test: this.project.test
}
},
computed: {
project () { return this.$store.getters['project/project'] }
}
}
In this case, I have a store which produces the project
object (not observable) with a test
property (observable).
The problem is that if project
changes, the subscription for test
doesn't update to the new project.test
-- so subsequent updates from the new project's test
observable are not observed by the component.
How can this be addressed?
regou commented
If you want use observers irrelevant to a component’s lifecycle, use them without vuex
subscriptions
is a .subscribe
sugar in create lifecycle
If constantly switching between different observables is what you want, try switchMap