Skip to content

feat(filters): save active filters for movies and tv - #3219

Open
modarah wants to merge 6 commits into
seerr-team:developfrom
modarah:feature-save-active-filters
Open

feat(filters): save active filters for movies and tv#3219
modarah wants to merge 6 commits into
seerr-team:developfrom
modarah:feature-save-active-filters

Conversation

@modarah

@modarah modarah commented Jul 2, 2026

Copy link
Copy Markdown

Description

This is the implementation of feature request to save active filters in movies and series.

Closes #369

The PR adds:

  • a hook to manage saving and retrieving filters in local storage which uses QueryFilterOptions for parsing.
  • Save active filter button inFilterSlideover component.
  • new translation key for the new button with DE translation

The hook gets initiliased in FilterSlideover and uses type movie and tv to create a storage key for each when clicking on the save button and use it for retrieving data on render.
Clear active filters button also removes the values from local storage. I added a delete button because users might want to clear the active filters and set other filters without losing the one that they explicitly saved but then went agains it (three buttons is too much).
The saved filters in local storage will only be updated if the user clicks on the save button, so adding other filters without clicking save won't affect the saved ones.

I went with localStorage to keep it simple. If syncing between devices is required then we need a new column in some table somewhere.

AI:

Claude code for the first draft.

How Has This Been Tested?

  • Clicked filters, saved them, removed them and navigated between pages
  • No errors when running typecheck
  • pnpm build

Screenshots / Logs (if applicable)

grafik

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Summary by CodeRabbit

Summary

  • New Features

    • Added a full-width “Save Active Filters” action to the Discover filter panel.
    • Saved filters now automatically reapply when you reopen the filter panel.
  • Updates / Improvements

    • Clear Active Filters now removes saved filter settings and closes the panel (no direct query-state clearing).
    • Added localized notifications when saving or removing filters fails.
  • Documentation

    • Updated Discover filter panel translations for the new button and related error messages (including German and English).

@modarah
modarah requested a review from a team as a code owner July 2, 2026 13:50
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds per-type localStorage persistence for Discover filters, restores saved filters when the current filter set is empty, and adds save/remove controls with English and German translations.

Changes

Saved Filters Feature

Layer / File(s) Summary
Saved-filter storage hook
src/hooks/useSavedFilters.ts
Defines per-type storage keys, validates stored filters, handles storage errors with localized toasts, and exposes save, read, remove, and update-state APIs.
FilterSlideover persistence integration
src/components/Discover/FilterSlideover/index.tsx, src/i18n/locale/en.json, src/i18n/locale/de.json
Restores saved filters into query parameters, adds save and remove actions, updates the button layout, and adds translations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FilterSlideover
  participant useSavedFilters
  participant localStorage
  participant QueryParams

  FilterSlideover->>useSavedFilters: getSavedFilters()
  useSavedFilters->>localStorage: read saved filters
  localStorage-->>useSavedFilters: parsed filter data
  FilterSlideover->>QueryParams: batchUpdateQueryParams(savedFilters)
  FilterSlideover->>useSavedFilters: saveFilters(currentFilters)
  FilterSlideover->>useSavedFilters: removeSavedFilters()
Loading

Suggested reviewers: 0xsysr3ll, danshilm

Poem

A bunny saved filters snug and bright,
They hop back in when timing’s right. 🐰
One button stores the chosen view,
One clears the saved set anew.
Local hops make filters stay.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: saving active filters for movies and TV.
Linked Issues check ✅ Passed The PR adds save/restore persistence for movie and TV filters with a save button, matching issue #369.
Out of Scope Changes check ✅ Passed The changes stay focused on filter persistence, UI, and translations with no clear unrelated additions.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Discover/FilterSlideover/index.tsx`:
- Around line 70-83: The FilterSlideover effect is re-running endlessly because
save filters state is always truthy and updateLocalStorage.current never gets
turned off; update the logic in useSavedFilters/getSavedFilters usage so the
query-param sync runs only once per intended hydration. In the useEffect inside
FilterSlideover, set updateLocalStorage.current to false after the initial
batchUpdateQueryParams(savedFilters) call (or otherwise gate it with a stable
one-time flag), and avoid depending on the fresh object returned by
getSavedFilters() each render so the effect does not retrigger on every render.
- Around line 79-83: The restore effect in FilterSlideover is overwriting active
URL-provided filters whenever savedFilters exists. Update the useEffect around
batchUpdateQueryParams so it only restores savedFilters when currentFilters is
empty or otherwise not already set, and keep the guard tied to
updateLocalStorage.current to avoid clobbering intentional filters on load.

In `@src/hooks/useSavedFilters.ts`:
- Around line 32-33: Guard the localStorage writes in useSavedFilters so a
thrown setItem/removeItem error does not break callers like FilterSlideover.
Update saveFilters and the corresponding remove/reset path to catch storage
exceptions and fail safely, keeping onClick flows able to continue and onClose
still executing. Use the existing useSavedFilters hook and its
saveFilters/remove logic as the place to add the protection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f0edb5de-42e8-4514-9b94-9df8bb25233f

📥 Commits

Reviewing files that changed from the base of the PR and between ebac489 and 373ac23.

📒 Files selected for processing (4)
  • src/components/Discover/FilterSlideover/index.tsx
  • src/hooks/useSavedFilters.ts
  • src/i18n/locale/de.json
  • src/i18n/locale/en.json

Comment thread src/components/Discover/FilterSlideover/index.tsx Outdated
Comment thread src/components/Discover/FilterSlideover/index.tsx Outdated
Comment thread src/hooks/useSavedFilters.ts Outdated
@modarah
modarah marked this pull request as draft July 2, 2026 14:03
@modarah
modarah marked this pull request as ready for review July 2, 2026 14:43
@modarah
modarah force-pushed the feature-save-active-filters branch 2 times, most recently from 82d922e to 3f83f45 Compare July 29, 2026 17:03
@modarah
modarah force-pushed the feature-save-active-filters branch from 3f83f45 to 3ef57b1 Compare July 29, 2026 18:03
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.

[Feature Request] Save active filter in Movies and Series

1 participant