educob
November 17, 2018, 3:58pm
1
Hi all.
I have lost so many hours/days with this issue and I still don’t know how to properly deal with it.
Let’s say I subscribe to “multisignature”
I also want to subscribe to address that depends on multisignature.
So if I write:
mounted() {
this.$subscribe('address', [ this.multisignature.p2sh ])
},
meteor: {
address() {
return Address.findOne( { _id: this.multisignature.p2sh } )
},
But this doesn’t work cause when subscribing this.multisignature is not defined yet.
I have tried to $subready.multisignature to no avail.
Any general way to deal, as elegantly as possible, with this dependent subscriptions?
Thanks.
What front-end package are you using?
educob
November 17, 2018, 5:15pm
3
I am using Meteor - Vue.
I made it work with a non-elegant solution:
watch: {
'$subReady.multisig' (value) {
if(value) {
this.$subscribe('address', [ this.multisig.p2sh ] )
}
},
meteor: {
addr() {
if(!!this.multisig)
return Address.findOne( { _id: this.multisig.p2sh }, { } )
return {}
},
...
This if(!!this.multisig
) made the trick.
I consider it ugly as hell.
Any other way more elegant to do it?
Hey, maybe you’re looking for this package?
It let’s you send docs from multiple collections on a subscription, and setup “child” subscriptions that select based on the results of parent subscriptions.
Hey, how are you using Vue with Meteor ?
1 Like
educob
November 19, 2018, 3:00am
5
Thanks.
I will take a look at it.