Closed mvcdev closed 7 years ago
@mvcdev i'm not sure if publishComposite is also hooking on the find
method somehow.
I need to check but i can't do it right now.
Can you maybe write a small repro project?
Hi @namirsab! Here is the new repository. Here is the piece of code illustrating the issue: https://github.com/mvcdev/todos/blob/master/imports/api/tasks.js#L7-L36
I'm pretty sure this is related to meteor/meteor#8031 and meteor/meteor#8629 which @mitar and I are working on to get fixed.
People should just start using https://github.com/peerlibrary/meteor-user-extra. ;-)
This issue does not lie in this package. publish-composite runs the children code on the server implicitly in new fibers without binding the environment​, which makes the in current invocation being lost and the accompanying userId.
I'll put together a PR some time this week.
I'm closing this as https://github.com/englue/meteor-publish-composite/pull/105 should resolve this.
We're using this package: https://github.com/englue/meteor-publish-composite. Not sure on which side is the issue.
We have the following publication:
Meteor.publishComposite('candidates', function() { return { find() { return Candidates.find(); }, children: [ { find(candidate) { return Jobs.find(candidate.jobId); } } ] }; });
We have the following hook:
Jobs.before.find(function (userId, selector, options, cursor) { // userId is undefined when it's called from children publication });