Skip to content

mobile: remember selected filters across reloads - #3567

Merged
xirvik merged 2 commits into
Novik:masterfrom
jakobbg:mobile-persist-filters
Nov 22, 2026
Merged

xirvik merged 2 commits into
Novik:masterfrom
jakobbg:mobile-persist-filters

Conversation

@jakobbg

@jakobbg jakobbg commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Summary

In the mobile view, the sort order, theme, and accent color persist across reloads via webui.mobile.* settings, but selected filters (status, label, tracker) were held only in memory. When clicking the reload button (mobile.refresh()), active filters were reset and the list reverted to displaying all torrents.

Changes

  • Persist committed filters: Save active filters under webui.mobile.filters when committed in filterDone().
  • Restore at startup: Added plugin.storedFilters() to load, validate, and sanitize the saved filters on initialization in plugin.init(). Unknown status options, corrupted JSON, and non-string values are safely discarded.
  • Guard filter pruning: Prevent applyFilters() from dropping label/tracker filters before torrent data has been loaded.
  • Ensure torrent labels are registered: Register labels present on torrents during processTorrents() even if the desktop category panel has not finished populating on the initial paint.
  • Tests: Added unit tests in tests/plugins/mobile/settings.spec.js covering storedFilters, filterDone saving behavior, and applyFilters preservation.

Note: This pull request was prepared with AI assistance.

In the mobile view, sorting, theme, and accent color persist across reloads
via webui.mobile.* settings, but selected filters were only held in memory.
When clicking the reload button (or refreshing the page), active filters
were lost and the list reverted to displaying all torrents.

Save active filters under webui.mobile.filters when committed in filterDone,
and restore them at startup via plugin.storedFilters. Validate and sanitize
stored filters so unknown status options and non-string values are ignored.
Guard applyFilters from dropping filters before torrents are loaded, and
ensure torrent labels are registered even if the desktop category panel has
not yet populated on initial paint.

Includes unit test coverage for storedFilters, filterDone, and applyFilters.

Assisted-by: AI (Google DeepMind / Antigravity)
Copilot AI balanced review requested due to automatic review settings November 22, 2026 14:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@jakobbg
jakobbg requested an adaptive review from Copilot November 22, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@xirvik
xirvik merged commit 537473f into Novik:master Nov 22, 2026
12 checks passed
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.

3 participants