Skip to content

fix: retain scroll position in details panel tables during periodic updates - #346

Merged
stabldev merged 4 commits into
mainfrom
fix/details-table-scroll-retention
Aug 27, 2026
Merged

fix: retain scroll position in details panel tables during periodic updates#346
stabldev merged 4 commits into
mainfrom
fix/details-table-scroll-retention

Conversation

@stabldev

Copy link
Copy Markdown
Owner

Summary

Fixes the issue where scrolling down tables in the torrent details panel (Peers, Trackers, Files) would jump back to the top whenever the 1-second polling update occurred.

Cause

Previously, update_peers(), update_trackers(), and update_files() called table.clear() on every tick, which emptied all rows and reset Textual's viewport scroll_y offset to 0.

Fix

  • In-place row updates (Key Diffing): Assigned unique row keys (peer.ip, tracker.url, file.index).
  • On each tick:
    • Existing rows are updated in-place via table.update_cell(...) only when cell contents change, leaving the table's DOM and scroll offset untouched.
    • New entries are appended via table.add_row(..., key=key).
    • Disconnected entries are removed via table.remove_row(...).
  • Added clear_tables() to DetailsPanel called when selecting a different torrent to ensure data refreshes cleanly between torrents.
  • Added comprehensive unit tests in tests/test_widgets_details_panel.py verifying scroll position retention and in-place row updates.

@stabldev
stabldev merged commit 3bcd7d5 into main Aug 27, 2026
9 checks passed
@stabldev
stabldev deleted the fix/details-table-scroll-retention branch August 27, 2026 16:45
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.

1 participant