signalpoint / views_infinite_scroll

The Views Infinite Scroll module for DrupalGap.
GNU General Public License v2.0
2 stars 2 forks source link

After Scrolling Down and then scrolling back up, reloads page 0 and gives duplicates #9

Open mkinnan opened 8 years ago

mkinnan commented 8 years ago

If you scroll down and load a few pages via views_infinite_scroll, then scroll back to the top it shows the reload wheel and inserts page-0 items again when you scroll back down. The result is page-0, page-0, page-1, page-2, etc. items.

mkinnan commented 8 years ago

I'm still having this issue. Any clue as to where in the module to investigate this issue?

signalpoint commented 7 years ago

@mkinnan Probably right around here: https://github.com/signalpoint/views_infinite_scroll/blob/7.x-1.x/views_infinite_scroll.js#L154

mkinnan commented 7 years ago

Haven't gotten this figured out yet ... this appears to be related issue:

https://github.com/signalpoint/views_infinite_scroll/issues/10

mkinnan commented 7 years ago

Some debugging notes ... page is set for displaying 10 items. I load the page in the app. I scroll down the page until I hit the bottom to load the next page (items 11-20). view_infinite scroll logs show:

============================
down
activePage: [object Object]
scrolled: 765
screenHeight: 800
contentHeight: 1486
header: 43
footer: -1
view: [object Object]
scrollEnd: 728
on page 1 of 10
GET: http://example.com/?q=mycustompage/0&page=1
200 - OK

I scroll down again to reach end of the page and get these logs:

============================
down
activePage: [object Object]
scrolled: 2021
screenHeight: 800
contentHeight: 2742
header: 43
footer: -1
view: [object Object]
scrollEnd: 1984
on page 2 of 10
GET: http://example.com/?q=mycustompage/0&page=2
200 - OK

I then scroll to the top and when I reach the header/top I get the following logs and then the page jumps down to show the start of page 2 (because it reloads page 2 again for duplicate content):

============================
up
activePage: [object Object]
scrolled: 0
screenHeight: 800
contentHeight: 3997
header: 43
footer: -1
view: [object Object]
scrollEnd: 3239
on page 3 of 10
GET: http://example.com/?q=mycustompage/0&page=0
200 - OK

I then scroll back to the top again and get these:

============================
up
activePage: [object Object]
scrolled: 0
screenHeight: 800
contentHeight: 5253
header: 43
footer: -1
view: [object Object]
scrollEnd: 4495
on page 1 of 10
mkinnan commented 7 years ago

Apparently, if you follow what I did above ... ... and then scroll all the way back to the bottom it jumps all the way to page 10 but it should have gone to page 4 (note I added a console.log for next_page):

activePage: [object Object]
scrolled: 4532
screenHeight: 800
contentHeight: 5253
header: 43
footer: -1
view: [object Object]
scrollEnd: 4495
on page 1 of 10
next_page: 10
GET: http://example.com/?q=mycustompage/0&page=10
200 - OK
mkinnan commented 7 years ago

I think we need another variable called previous_page ...

Any more thoughts on this issue?

mkinnan commented 7 years ago

I've got Part A solved ... at least it appears that way ... working on Part B ... when it jumps to page 10. Once I get figured out hopefully this weekend will post a commit.

mkinnan commented 7 years ago

Please review my hackish job with this, but it does work for me in Emulator. Scrolling up and down all kinds of different ways. Seems to work OK now.

https://github.com/signalpoint/views_infinite_scroll/pull/12

mkinnan commented 7 years ago

Commit appears to work fine on Android compiled app.