mharris717 / ember-cli-pagination

Pagination Addon for Ember CLI
MIT License
273 stars 116 forks source link

query param with refreshModel: true breaks the page #252

Open zion opened 6 years ago

zion commented 6 years ago

I was investigating an issue with the search feature of my app and found that if there is:

queryParams: {
    search: {
      refreshModel: true
    }
  },

in the route, as soon as the search property is changed, the page freezes up and eventually crashes. This used to work just fine, but now is completely broken.

Has anyone experienced that?

The entirety of the route is this:


  status: inject(),
  queryParams: {
    search: {
      refreshModel: true
    }
  },
  model(params){
    params.paramMapping = {
      total_pages: 'total-pages',
      perPage: 'limit'
    }
    return RSVP.hash({
      orders: this.findPaged('order', params)
      // orders: this.store.query('order', params)
    })
  },
  setupController(controller, models){
    controller.set("orders", models.orders);
  }
});```
zion commented 6 years ago

Actually I think the issue is combining route mixins with other mixins

mpanic commented 5 years ago

Same thing is happening for me. The problem is in overriding "then" method of the PromiseProxy, which then gets into infinite recursion. Anyone has any idea what would it take to rewrite the following code to prevent infinite recursion?

var ArrayProxyPromiseMixin = Ember.Mixin.create(Ember.PromiseProxyMixin, {
  then: function(success,failure) {
    var promise = this.get('promise');
    var me = this;

    return promise.then(function() {
      return success(me);
    }, failure);
  }
});