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.

PagingWithNetwork: loadAfter() not working correctly after invalidate() is called

See original GitHub issue

Using the PagingWithNetwork and Network only (by page). Change the pageSize to 1 or 2 in SubRedditViewModel. Then, after a swipe-to-refresh (so invalidate() is called) the loadAfter() method is not called anymore. Any recommendation to avoid this?

(I am having same behavior in my app with a higher page size)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
biubiuqiu0commented, Oct 17, 2018

This problem because of your refreshed data is same to old data ,cause adapter don’t perform getItem(),so it can’t perform loadAround() and loadAfter().

0reactions
ChrisCraikcommented, Oct 17, 2018

This issue was also filed in the library bug tracker as https://issuetracker.google.com/issues/113122599

This problem because your refreshed data is same to old data ,cause adapter don’t perform getItem(), so it can’t perform loadAround() and loadAfter().

To add more detail here, it’s because the initial load size fits within the viewport, and nothing changed. If the adapter sees nothing changed in viewport and the user can’t scroll, there’s nothing to trigger further loads.

We put in a sort of workaround in 2.1.0 (alpha), but as said in the bug and release notes, the real fix is having a large enough initial load size. The initial load size defaults to 3x page size - change your initial load size to be larger (with Config.Builder.setInitialLoadSizeHint()), and the problem will go away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Paging Library - DataSource didn't invalidate itself after ...
Need I add the addtional code aboved, to obsever the "statuses" table and invalidate the data source? But it seems NOT a efficient...
Read more >
Gather paged data - Android Developers
Choose the correct data source type ... To do so, call invalidate() from the DataSource class that you've chosen for your app. ......
Read more >
Refresh key is not preserved when PagingSource is ...
When a PagingSource is invalidated before it has loaded any page, the subsequent PagingSource does not get getRefreshKey called and initial load key...
Read more >
paging - OSCHINA - 中文开源技术交流社区
paging是一款用于在页面上快速切换上一页、下一页的Chrome插件。 paging对页面解析时,会按照站点配置规则-> 默认解析规则的优先级进行处理。
Read more >
Android Architecture Component - PagingLibrary
Paging libraries can help you load and display small pieces of data at a time. Loading part of the data on demand can...
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