Blocking actions and user events until promise resolution


Having the ability to block actions and view events is a common pattern which I need to use in some cases.

I think than actions and view events could be blocked when an action handler returns a promise whose state is pending of resolution.

// route, controllers, components, views
  actions: {
    purchase: function() {
      // Do any async task which blocks 
      // the execution of other events till its resolution.
      // It ensures other actions do not interfere its result
      return Ember.RSVP.promise(function(resolve, reject) {

              // when the promise is fulfilled, the UI unblocks 

Saving the state of a critical promise lets to manage the dispatch of user interaction events and other system events based on promise resolution.

I have not yet seen any discussion of this use case and would like to know if others find it useful or other possible solutions.

Asynchronous Actions

To clarify, when you say that events would be “blocked”, do you mean that Ember would actually suppress events while waiting for the promise to resolve?

That is,

  1. User clicks a view.
  2. The click method returns a promise that resolves 5 seconds later.
  3. User immediately clicks the view again.
  4. Since the promise from step (2) is not yet resolved, Ember ignores the event and does not call the view’s click method.


Yes, this is the behaviour, I changed the initial approach, in order only the actions can block the UI.

This pattern was already discussed at “Asynchronous Actions”.