Hello, I am having trouble updating a form’s default values to be set as soon as a subscription is ready. Actually I’m not sure that is the best model to do what I’d like, but it is my best idea on how to approach it so far. (Sorry I am quite new to Meteor and Vue).
mounted() {
if (this.$subReady['activities']) {
const recentActivity = this.activities[0];
this.activityForm = recentActivity;
}
},
Based on https://github.com/meteor-vue/vue-meteor-tracker documentation I am trying the code above but it does not register the data from meteor. If I change from mounted to beforeUpdate it pulls the data but then it will repeat on every change to the data. I am only trying to set a default value if there is a recent entry, otherwise fallback to a set of default initialized values.
In case it is relevant this is the subscription code:
meteor: {
$subscribe: {
'activities': [],
},
activities() {
return Activities.find({}, {sort: {createdAt: -1}});
},
},