When you call a method that has some side-effects (manipulates some collections), the returned promise resolves when the result event for that method is emitted.
Looking at the meteor guide about the method lifecycle, the promise should resolve when the updated event for the method is emitted.
In the Meteor client, the result event "doesnt call the Method callback yet". It only saves the return value for later when calling the callback after the updated event.
@pscanf @davidebianchi I am happy to provide a PR to fix this behaviour if you agree.
Here is a screenshot of the DDP events exchanged when invoking a method, that shows clearly that there is a lot of stuff still happening after the result event is emitted:
When you call a method that has some side-effects (manipulates some collections), the returned promise resolves when the
result
event for that method is emitted.Looking at the meteor guide about the method lifecycle, the promise should resolve when the
updated
event for the method is emitted. In the Meteor client, theresult
event "doesnt call the Method callback yet". It only saves the return value for later when calling the callback after theupdated
event.@pscanf @davidebianchi I am happy to provide a PR to fix this behaviour if you agree. Here is a screenshot of the DDP events exchanged when invoking a method, that shows clearly that there is a lot of stuff still happening after the![image](https://cloud.githubusercontent.com/assets/8394418/19838670/899a76e6-9ed4-11e6-9273-b6e12d586e27.png)
result
event is emitted: