ember-infinity
ember-infinity copied to clipboard
Loading previous pages causes next page data to load incorrectly
Steps to reproduce:
- Load a new infinity model with a
startingPage
greater than 1 - Load data for a previous page, then
- Load data for a next page
Expected result: The next page data loads the page after the startingPage
Actual result: The next page data loading the startingPage
's data again and inserts it into the list.
I've reproduced this in an Ember twiddle here: https://ember-twiddle.com/a5b7a21d64accee06ccb9217f2778e84
Digging around in the ember-infinity source code, it looks like currentPage
is incremented and decremented based on whether you are loading the previous and next pages. I think that will need to be changed to two variables: one that indicates what the first page is (for previous page loading), and another to indicate what the last page is (for next page loading).
Let me know if I'm missing something here. I'd be happy to try to put together a pull request if you agree that the bug exists and like my proposed solution. In the meantime, I think I can workaround the issue by creating a custom InfinityModel
class to override the buildParams
function
I’ve got some work in progress for this specific scenario/use case. It ends up requiring a fairly major refactoring of both InfinityModel and the core infinity service.
Unfortunately, I’m no longer working daily in ember, so I’m going to have to find some scarce marginal time to put the PR together.
John Calvin
On Dec 20, 2018, at 6:37 PM, Kenny Foisy [email protected] wrote:
Steps to reproduce:
Load a new infinity model with a startingPage greater than 1 Load data for a previous page, then Load data for a next page Expected result: The next page data loads the page after the startingPage Actual result: The next page data loading the startingPage's data again and inserts it into the list.
I've reproduced this in an Ember twiddle here: https://ember-twiddle.com/a5b7a21d64accee06ccb9217f2778e84 https://ember-twiddle.com/a5b7a21d64accee06ccb9217f2778e84 Digging around in the ember-infinity source code, it looks like currentPage is incremented and decremented based on whether you are loading the previous and next pages. I think that will need to be changed to two variables: one that indicates what the first page is (for previous page loading), and another to indicate what the last page is (for next page loading).
Let me know if I'm missing something here. I'd be happy to try to put together a pull request if you agree that the bug exists and like my proposed solution. In the meantime, I think I can workaround the issue by creating a custom InfinityModel class to override the buildParams function
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ember-infinity/ember-infinity/issues/349, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1dqJqxLz3yQYxdYBuwRBFEzamLdhb_ks5u7B8tgaJpZM4ZdF72.