PagingWithNetwork: loadAfter() not working correctly after invalidate() is called
See original GitHub issueUsing 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:
- Created 5 years ago
- Reactions:3
- Comments:7 (1 by maintainers)
Top 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 >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
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().
This issue was also filed in the library bug tracker as https://issuetracker.google.com/issues/113122599
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.