meteor-partitioner
meteor-partitioner copied to clipboard
User's group is lost across Meteor environment callbacks: Meteor.{defer, setTimeout, setInterval}
Hi mizzao I noticed that we can't operate on partitioned collections inside meteor.defer. Were you able to work it out prior to the issue you've posted on Meteor repo https://github.com/meteor/meteor/issues/2221 ?
Please help. Thanks
Yeah, I usually just store the group from Partitioner.group()
and then Partitioner.bindGroup
explicitly in the defer function.
This is because DDP._CurrentInvocation.get()
is undefined in the defer block, so we don't know what user context it is in.
nice! Thanks! I will try this.
it worked! :dancers:
Let's leave this open as a signpost so that people know about it and as something that we may be able to fix or improve in the future. This would affect Meteor.defer
, Meteor.setInterval
, and Meteor.setTimeout
.
By the way, if you are using Meteor.defer
, you may want to just consider the possibility of doing this.unblock()
in the method and going on with whatever is happening in the defer block, so you don't have to avoid these gynmastics.