Skip to content

🐛 keep the newest paste fully in view when prepended at the list start - #5237

Merged
guiyanakuang merged 1 commit into
mainfrom
fix/search-window-prepend-anchor
Oct 21, 2026
Merged

guiyanakuang merged 1 commit into
mainfrom
fix/search-window-prepend-anchor

Conversation

@guiyanakuang

Copy link
Copy Markdown
Member

Closes #5236

Summary

  • Replace the after-the-fact animateScrollToItem(0) recovery with a SideEffect that runs before the new items are measured. If the list sits exactly at its start (firstVisibleItemIndex == 0 && firstVisibleItemScrollOffset == 0) when the newest item changes, it calls requestScrollToItem(0), which overrides LazyList's key-based anchoring for the next measure. There is no scroll animation left to be interrupted, so the newest item can no longer end up half off-screen.
  • When the user has scrolled away, nothing is requested and the default key anchoring keeps the viewport where it is.
  • Wrap each slot (spacer + card) in Row(Modifier.animateItem()), so a prepended paste fades in while the existing cards slide right (removals fade out).
  • Reopening the window is unchanged: resetToTop() still uses index-based scrollToItem(0).

Test plan

  • Search window at the start, copy new content: the new item appears fully at the front with the insertion animation
  • Scrolled several screens in, copy new content: the visible items do not move
  • Inserting while searching/filtering and deleting an item animate naturally

@guiyanakuang
guiyanakuang merged commit 2abafc7 into main Oct 21, 2026
7 checks passed
@guiyanakuang
guiyanakuang deleted the fix/search-window-prepend-anchor branch October 21, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Newest paste is half off-screen when added while the search window is at the start

1 participant