Skip to content

Fix scroll jitter and add lightweight typing refresh#366

Merged
benthecarman merged 1 commit intosledtools:masterfrom
benthecarman:fix-refresh-cost
Mar 1, 2026
Merged

Fix scroll jitter and add lightweight typing refresh#366
benthecarman merged 1 commit intosledtools:masterfrom
benthecarman:fix-refresh-cost

Conversation

@benthecarman
Copy link
Collaborator

Closes #364 (partial — typing indicator path)

Summary

  • iOS: Replace manual diff logic in InvertedMessageList with UITableViewDiffableDataSource for correct index computation. Only apply snapshots when row IDs actually change to prevent scroll-blocking feedback loops.
  • Rust: Add refresh_typing_if_open for typing indicator updates without re-fetching messages from storage.

Problem

  1. The manual insertRows/deleteRows diff used wrong indices, causing scroll jitter during pagination
  2. updateUIView was called on every binding change (including isAtBottom during scroll), reapplying the data source snapshot and blocking scrolling
  3. Typing indicators triggered a full refresh_current_chat which re-fetches all loaded messages from storage

Test plan

  • cargo clippy and cargo test pass
  • Scrolling is smooth in chats of all sizes
  • Pagination loads older messages without jitter
  • Typing indicators update without lag
  • New messages appear at bottom when at bottom

🤖 Generated with Claude Code

iOS: Replace manual diff logic in InvertedMessageList with
UITableViewDiffableDataSource which handles index computation
correctly and avoids unnecessary cell reconfiguration.

Rust: Add refresh_typing_if_open for typing indicator updates
without re-fetching messages from storage. Reverts the target
cap which broke the UI by only sending 50 messages to the client.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Collaborator

@futurepaul futurepaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huge perf win

@benthecarman benthecarman merged commit 6bab05d into sledtools:master Mar 1, 2026
15 checks passed
@benthecarman benthecarman deleted the fix-refresh-cost branch March 1, 2026 23:43
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.

refresh_current_chat cost escalates with scroll depth, blocking UI on large chats

2 participants