Skip to content

Conversation

Copy link

Copilot AI commented Nov 30, 2025

User filter preferences (sort field, sort direction, state filter) are now persisted to localStorage and restored on page load.

Changes

  • New PreferencesService - Handles localStorage read/write with validation for corrupted/invalid data
  • AppComponent integration - Loads preferences on init, saves on change via property setters
  • Type safety - Added SortField union type restricting valid sort values

Stored Preferences

interface UserPreferences {
  sortByField: SortField | null;  // 'State' | 'TimeAdded' | 'Progress' | ...
  sortReverse: boolean;
  filterState: State | null;      // 'Active' | 'Downloading' | 'Seeding' | ...
}

Screenshot

After selecting filters and refreshing the page, preferences are restored:

Preferences persisted

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • accounts.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3863 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-75936549 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2344358832365387046,1266882387370985235,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-75936549 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=75936549 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4023 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-57689991 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,15911362977511374243,1810406567735880517,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • android.clients.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4023 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-57689991 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,15911362977511374243,1810406567735880517,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-57689991 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=57689991 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4198 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-95066792 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4025110524598156603,14072393095302940932,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • clients2.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3863 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-75936549 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2344358832365387046,1266882387370985235,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-75936549 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=75936549 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4023 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-57689991 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,15911362977511374243,1810406567735880517,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • clientservices.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3863 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-75936549 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2344358832365387046,1266882387370985235,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-75936549 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=75936549 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4023 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-57689991 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,15911362977511374243,1810406567735880517,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • redirector.gvt1.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3863 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-75936549 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2344358832365387046,1266882387370985235,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-75936549 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=75936549 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4023 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-57689991 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,15911362977511374243,1810406567735880517,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • safebrowsingohttpgateway.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3863 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-75936549 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2344358832365387046,1266882387370985235,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-75936549 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=75936549 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4023 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-57689991 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,15911362977511374243,1810406567735880517,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • www.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3863 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-75936549 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2344358832365387046,1266882387370985235,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-75936549 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=75936549 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4023 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-57689991 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,15911362977511374243,1810406567735880517,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Store user preferences (the filters) into local storage


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 30, 2025 07:32
…orage

Co-authored-by: wcypierre <1132980+wcypierre@users.noreply.github.com>
…nces

Co-authored-by: wcypierre <1132980+wcypierre@users.noreply.github.com>
Copilot AI changed the title [WIP] Store user preferences in local storage Store user preferences (filters) in local storage Nov 30, 2025
Copilot AI requested a review from wcypierre November 30, 2025 07:40
@wcypierre wcypierre marked this pull request as ready for review November 30, 2025 07:41
Copilot AI review requested due to automatic review settings November 30, 2025 07:41
@wcypierre wcypierre merged commit 08b8e52 into bugfix/last-card-cut-off Nov 30, 2025
2 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements localStorage persistence for user filter preferences (sort field, sort direction, and state filter) to improve user experience by remembering their selections across page reloads.

Key Changes

  • New PreferencesService: Manages localStorage operations with validation and error handling for user preferences
  • Type-safe sorting: Introduced SortField union type to restrict valid sort values
  • AppComponent integration: Property setters automatically save preferences; preferences are loaded on component initialization

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/app/preferences.service.ts New service handling localStorage read/write operations with validation for corrupted data
frontend/src/app/preferences.service.spec.ts Comprehensive test suite covering service methods, validation, and edge cases
frontend/src/app/app.component.ts Integration of PreferencesService with property getters/setters and initialization logic
frontend/src/app/app.component.html Updated filter dropdown to use new onFilterStateChange method and one-way binding
frontend/package-lock.json Automatic dependency cleanup (optional dependencies reorganization)
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const STORAGE_KEY = 'storm_preferences';

const VALID_SORT_FIELDS: SortField[] = ['State', 'TimeAdded', 'Progress', 'ETA', 'Name', 'TotalSize', 'Ratio', 'SeedingTime'];
const VALID_FILTER_STATES: (State | null)[] = [null, 'Active', 'Queued', 'Downloading', 'Seeding', 'Paused', 'Error'];
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

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

The VALID_FILTER_STATES array is missing some State values that exist in the State type. The State type includes 'Allocating', 'Checking', and 'Moving', but these are not present in the validation array. This means if a user saves preferences with these states, they will be reset to null on load. Consider including all valid State values in the validation array:

const VALID_FILTER_STATES: (State | null)[] = [null, 'Active', 'Allocating', 'Checking', 'Queued', 'Downloading', 'Seeding', 'Paused', 'Error', 'Moving'];
Suggested change
const VALID_FILTER_STATES: (State | null)[] = [null, 'Active', 'Queued', 'Downloading', 'Seeding', 'Paused', 'Error'];
const VALID_FILTER_STATES: (State | null)[] = [null, 'Active', 'Allocating', 'Checking', 'Queued', 'Downloading', 'Seeding', 'Paused', 'Error', 'Moving'];

Copilot uses AI. Check for mistakes.
Comment on lines +134 to 142
constructor(private api: ApiService, private focus: FocusService, private dialogService: DialogService, private preferences: PreferencesService) {
// Load saved preferences
const savedPrefs = this.preferences.load();
this._sortByField = savedPrefs.sortByField;
this._sortReverse = savedPrefs.sortReverse;

this.get$ = new BehaviorSubject<OptionalState>(savedPrefs.filterState);
this.refreshInterval(2000);
}
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

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

The new preference-related functionality in AppComponent lacks test coverage. Consider adding tests to verify:

  1. Preferences are loaded correctly on initialization
  2. Property setters (sortByField, sortReverse) properly save preferences
  3. The onFilterStateChange method correctly updates both the BehaviorSubject and saves preferences
  4. Integration with PreferencesService works as expected

Copilot uses AI. Check for mistakes.
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.

2 participants