Open
Description
I love the Meteor integration, but have difficulties understanding reactivity and it's implementation.
Apparently meteor functions are running many times, even before the component is created or mounted? Here is a meteor block I have in a component. It's subscribing to items
publication based on a computed query. $subscribe
and itemsCursor
is triggered many times, even before the component is ready or meteor is active, and I do not understand why.
created(){
const component = this;
component.$startMeteor();
},
meteor: {
$subscribe: {
items: function(){
const component = this;
console.log(`$subscribe mounted=${component._isMounted}`, component.query);
return [ component.query , {limit:9} ];
}
},
itemsCursor () {
const component = this;
const isMounted = component._isMounted;
const meteorActive = component._meteorActive;
// this runs several times, even before component is created or mounted
console.log(`itemsCursor found ${Items.find().count()} items mounted=${isMounted} meteor active=${meteorActive}`);
return Items.find({}, {
sort: {created: -1}
});
},
},
Metadata
Metadata
Assignees
Labels
No labels