Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Attachment actions
Unintended behavior
View staffing
Description
Version used: alpha 5
Devices/Android versions reproduced on: Pixel (8.1) and Emulator (7.0)
When placeholders are disabled, the `RecyclerView` will sometimes jump positions when data is added or removed from the database. This has been observed in my own project which doesn't use Room as well as the PagingSample which does. Both use a subclass of `PositionalDataSource`.
It appears what happens is the `loadInitial` call that happens on the new `DataSource` has an incorrect start position. It appears to be the page size. This causes the next page to be loaded first, followed by data that is visibly on screen. Once the initial page is loaded, the `RecyclerView` sees this as the full data set so the view appears "scrolled" to that position. Then the subsequent `loadRange` call comes in that loads from position 0. Since the `RecyclerView` sees this as added data it does not scroll.
Here is what happened to the `RecyclerView` in the attached screenrecord:
App Started:
- onItemRangeInserted. positionStart: 0 itemCount: 90
Added cheese "0":
- onItemRangeRemoved. positionStart: 89 itemCount: 1
- onItemRangeInserted. positionStart: 0 itemCount: 1
Remove Abbaye de Belloc:
- onItemRangeInserted. positionStart: 90 itemCount: 31
- onItemRangeRemoved. positionStart: 0 itemCount: 31
- onItemRangeInserted. positionStart: 0 itemCount: 30
- Sample project to trigger the issue.
This can be reproduced in the PagingSample project (