mondora / asteroid

An alternative client for a Meteor backend
MIT License
734 stars 101 forks source link

Methods resolve on `result` instead of `updated` event #109

Open PhilippSpo opened 7 years ago

PhilippSpo commented 7 years ago

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: image