onLoadMoreComplete(null) call from noMoreLoad() cause infinite loop
See original GitHub issueAccording to documentation of onLoadMoreComplete(@Nullable List<T> newItems)
When noMoreLoad OR onError OR onCancel, pass empty list or null to hide the progressItem.
If null or empty list is passed in onLoadMoreComplete() the last if clause is executed and noMoreLoad is called again.
v5.0.0-rc1
public void onLoadMoreComplete(@Nullable List<T> newItems, @IntRange(from = -1) long delay) {
// 1. Calculate new items count
int newItemsSize = newItems == null ? 0 : newItems.size();
int totalItemCount = newItemsSize + getMainItemCount();
// 2. Add any new items
if (newItemsSize > 0) {
if (DEBUG)
Log.v(TAG, "onLoadMore performing adding " + newItemsSize + " new items on Page=" + getEndlessCurrentPage());
//TODO: 0 + headers for Endless Top Scrolling
addItems(getGlobalPositionOf(mProgressItem), newItems);
}
// 3. Check if features are enabled and the limits have been reached
if (mEndlessPageSize > 0 && newItemsSize < mEndlessPageSize || // Is feature enabled and Not enough items?
mEndlessTargetCount > 0 && totalItemCount >= mEndlessTargetCount) { // Is feature enabled and Max limit has been reached?
// Disable the EndlessScroll feature
setEndlessProgressItem(null);
}
// 4. Remove the progressItem if needed
if (delay > 0 && (newItemsSize == 0 || !isEndlessScrollEnabled())) {
if (DEBUG)
Log.v(TAG, "onLoadMore enqueued removing progressItem (" + delay + "ms)");
mHandler.sendEmptyMessageDelayed(LOAD_MORE_COMPLETE, delay);
} else if (isEndlessScrollEnabled()) {
hideProgressItem();
}
// 5. Reset the loading status
endlessLoading = false;
// 6. Eventually notify noMoreLoad
if (newItemsSize == 0 || !isEndlessScrollEnabled()) {
noMoreLoad(newItemsSize);
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
RowSetIterator next() never returns null, causing infinite loop
I'm using JDeveloper 11.1.1.6. One tricky issue we found is looping through a view object using RowSetIterator. next() of RowSetIterator ...
Read more >why free function causes infinite loop? - Stack Overflow
You mustn't access to freed objects. In the delete_last functon, you called free() for one of the nodes, but you didn't update any...
Read more >Solved: Infinite loop caused by CDS Update trigger
I have a simple flow that when a CDS record is updated it updates an API. When updated that API responce with an...
Read more >How to change the limit of infinite loop iterations in Rational ...
Cause. The run-to-completion semantics of the Rational Rhapsody framework check for an infinite loop of NULL transitions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@davideas progressItem is not automatically hidden inside
void onLoadMoreComplete(@Nullable List<T> newItems, @IntRange(from = -1) long delay)
setEndlessProgressItem(null);
is called. insideendlessScrollEnabled
is set to false. than insidevoid onLoadMoreComplete(@Nullable List<T> newItems, @IntRange(from = -1) long delay)
hideProgressItem();
can’t be called becauseisEndlessScrollEnabled()
returns false.@eemihauk, removing the else condition should then work also when no items and no delay.