mharris717 / ember-cli-pagination

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

Octane update breaking changes #276

Closed brunoocasali closed 5 years ago

brunoocasali commented 5 years ago

Hello folks!

Currently I'm using the latest version of this library (3.1.5) and ember-source 3.12.0 and everything is working as well!

But we actually upgrading the app to ember octane and of course upgrading the ember version to latest beta 3.13.0-beta.x. After update we could not change between pages anymore.

I'm actually debugging the addon to find the problem, I'm justing posting here to open for discussions!

Have anyone tried to use this lib with octane version?

broerse commented 5 years ago

I did not but interested to see what the problem is. In a transition to Octane here https://github.com/broerse/ember-cli-blog

brunoocasali commented 5 years ago

The problem I'm facing is using PagedRemoteArray, when I click in the page number, they "change" to another page but right after refresh list the currentPage goes back to the old page.

I noticed the url does not change with the page number.

brunoocasali commented 5 years ago

The problem occurs right after upgrade to 3.13.0-beta.1, using the 3.12 everything works! :P

brunoocasali commented 5 years ago

@broerse I've made a small app just to try the pagination, and It works, so after change some other packages to latest version, my app has working again! Thanks for your help!

broerse commented 5 years ago

@brunoocasali Thanks for reporting. Hope you like this module.

paulyoder commented 4 years ago

@brunoocasali I'm running into the same issue when I upgraded from Ember 3.12 to 3.13.3

Do you know what packages you upgraded?

brunoocasali commented 4 years ago

@paulyoder Dude, I think I've upgrade all of them and the syntax that I'm using was with some inconsistencies too... Share your code here, I'll try to help you!

paulyoder commented 4 years ago

@brunoocasali I actually just removed ember-cli-pagination and "rolled my own" It only took a couple more lines to do the same thing.

Before

pagedItems: pagedArray('items', {
  page:    alias('parent.page'),
  perPage: alias('parent.perPage')
}),
totalPages: alias('pagedItems.totalPages'),

After

pagedItems: computed('page', 'perPage', 'items', function() {
  let offset = (this.page - 1) * this.perPage;
  return this.items.slice(offset, (offset + this.perPage));
}),
totalPages: computed('items', function() {
  return Math.ceil(this.items.length / this.perPage);
}),
westlywright commented 4 years ago

I am not so sure this should have been closed yet. I am facing this issue when upgrading from 3.12 -> 3.13/3.14. pagedArray does not get recomputed when I remove items from the prop that is being watched. In 3.12 when I remove an object from the watched array it recomputes as expected.