Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User's group is lost across Meteor environment callbacks: Meteor.{defer, setTimeout, setInterval} #15

Open
alur222 opened this issue Aug 26, 2015 · 4 comments
Labels

Comments

@alur222
Copy link

alur222 commented Aug 26, 2015

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 meteor/meteor#2221 ?

Please help. Thanks

@mizzao
Copy link
Collaborator

mizzao commented Aug 26, 2015

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.

@alur222
Copy link
Author

alur222 commented Aug 26, 2015

nice! Thanks! I will try this.

@alur222 alur222 closed this as completed Aug 27, 2015
@alur222
Copy link
Author

alur222 commented Aug 27, 2015

it worked! 👯

@mizzao
Copy link
Collaborator

mizzao commented Aug 27, 2015

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.

@mizzao mizzao reopened this Aug 27, 2015
@mizzao mizzao changed the title Can't operate partitioned collections inside Meteor.defer User's group is lost across Meteor environment callbacks: Meteor.{defer, setTimeout, setInterval} Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants