purecloudlabs/fixtable-ember

When totalOnServer is zero and current page is 0 an infinite loop can happen

Opened this issue · 0 comments

in fixtable-grid.js

afterCurrentPageChanged: _ember['default'].observer('currentPage', function fixtableGrid$afterCurrentPageChanged() {
var currentPage = this.get('currentPage'),
totalPages = this.get('totalPages');
if (currentPage < 1) {
this.set('currentPage', 1);
} else if (currentPage > totalPages) {
this.set('currentPage', totalPages);
}
//Ember.run.once(this, this.notifyReloadContent);
_ember['default'].run.debounce(this, this.notifyReloadContent, 300, false);
})

console output:
https://apps.mypurecloud.com/s/#/1/cmmwvzrmorajho6xpqzzesrljm

If someone sets currentPage to zero while totalPages is zero the value of currentPage will be set to 1 and that will cycle this observer to then evaluate currentPage > totalPages to true - which then sets the value to 0 again. The loop reaches stack limit and blows up.