I am totally stumped by trying to subscribe to a publication passing a router slug into the subscription.
Only during SSR the publication function doesn’t receive the argument as a string, but as individual characters.
The slug is a MongoID like iGLMpe7eRjavDeNyi
In my component I have
export default {
computed:{
Time(){
console.log(`computed Time for ${this.$route.params.id}`)
return Time.findOne(this.$route.params.id)
}
},
created(){
const id = this.$route.params.id;
this.$subscribe('Time', id);
},
}
and my publication is
Meteor.publish('Time', function (id) {
console.log(`publishing Time for ${id}`);
return id ? Time.find(id) : Time.find();
});
But during SSR (and only during that phase, regular routes from the client work) the publish function receives the id as individual characters, so the console.log during SSR is
publishing Time for i
Does anybody know what I am doing wrong?