adopted-ember-addons / adopted-ember-addons/ember-infinity

Issue with loadPrevious and scrollable

Open
#454 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
374
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have infinity working properly in a list, with the scrollable prop set, everything it's ok, but when I added a startingPage different to the first one things messed up. What is happening is, once I added the infinity-loader above the list, and for example startingPage set to 2, it's loading page 2 and page 1 before it, and that is ok, but, page 3 never loads, I have to scroll up and scroll down several times, and in each action previous page are loading again, having the same data multiple times. I am filtering the data to show just once. But that is not enough, in this case I have set a startingPage at 2, so, I can see the page 2 is requested, then the page 1, and after that I can see the loading indicator and nothing happens. But if I scroll a little bit up it try to fetch page 0, then I scroll down, page 1, scroll down page 2, scroll down and now it's fetching page 3.
I have tried some workaround with the buildParams method but couldn't find a way to solve it. Is there some way to don't fetch the data when is scrolling up for loadPrevious? or maybe something to do on buildParams?

I would appreciate any help with this!

```
{{#if conversations}}
{{#unless pagination.conversation.reachedInfinity}}
{{#infinity-loader infinityModel=conversationsList.conversations
loadPrevious=true
}}
{{/infinity-loader}}
{{/unless}}
{{#each conversations as |conversation|}}
{{conversation/list-item conversation=conversation
........
{{/each}}
{{#unless pagination.conversation.reachedInfinity}}
{{#infinity-loader infinityModel=conversationsList.conversations
scrollable='.conversationsList'
eventDebounce=150}}
{{loading-dots}}
{{/infinity-loader}}
{{/unless}}
{{/if}}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.