question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with endless scrolling and LOAD_MORE_RESET delay

See original GitHub issue

Working with the endless scrolling feature and items limit per page in server replies, I found out that if the limit is small enough for whatever reason, the adapter loads just the first page (other than the initial one, so 2 pages).

This happens because the adapter’s onLoadMoreComplete method sends the LOAD_MORE_RESET message to the handler with a delay of 200L (not editable) and before this delay has passed, the viewholder calls the adapter’s onLoadMore but finds the mLoading boolean to be true (because the handler is in charge of setting it to false upon receiving the LOAD_MORE_RESET message) and does nothing.

At this point it’s unable to re-trigger the onLoadMore method because there are few elements in the list for each pag so the recyclerview is not scrollable, the elements can’t be recycled and the built-in onBindViewHolder method (which calls the adapter’s onLoadMore) can’t be re-executed when the delay of the LOAD_MORE_RESET has passed.

I know this can be tricky to read but hope everything is clear. If something is not, please ask.

Is this actually a bug or am mis-implementing something?

@davideas

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
davideascommented, Oct 6, 2016

@Aselox, I removed the delay, but I had to modify the code in more points. I will commit in rc1 branch and i will create a SNAPSHOT this evening or tomorrow evening. Now, the loading more automatically fills the screen even one by one, until it’s full or no load more, then you need to scroll down to trigger again the listener.

0reactions
davideascommented, Nov 29, 2016

@borisdamato, please be aware that, Endless Scrolling is going to be changed very soon. In order to support the new features and a better logic, the behaviors and callbacks methods will be refactored.

Please check issue #233 for the latest developments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Infinite Scroll: Why It's So Addictive and How to Break Free
The infinite scroll is everywhere, and its pull is almost irresistible. Although a convenient feature at times, it has a dark side.
Read more >
Infinite Scrolling: When to Use It, When to Avoid It
Infinite scrolling minimizes interaction costs and increases user engagement, but it isn't a good fit for every website.
Read more >
What is Doomscrolling and How to Avoid It - Cleveland Clinic
1. Localize the behavior · 2. Use Mindfulness · 3. Avoid “catastrophizing” · 4. Practice thought stopping · 5. Slow the scroll ·...
Read more >
Infinite scroll delay after resume · Issue #2187 - GitHub
Hello! This is based on: #1990. In a scenario when you apply a filter to a list of items you would want refresh...
Read more >
How Infinite Scrolling Breaks UX - Webdesigner Depot
Yes, infinite scrolling is an alternative to delays of reaching content that pagination causes, but it creates its own problems, too. Designers ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found