Skip to content

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

Open
modarah wants to merge 7 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 7 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 to store your current filter settings.
    • Saved filters now automatically reapply when you reopen the filter panel.
  • Updates / Improvements
    • Clearing active filters now removes the saved filters state and dismisses the filter panel.
    • Added localized messaging to notify you if saving or removing filters fails.
  • Documentation
    • Updated Discover filter panel button text via new translations (including related error strings).

@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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9dcb97d4-cf51-4bd0-89bd-b34f478e99f5

📥 Commits

Reviewing files that changed from the base of the PR and between e9e6132 and 9bc7cdf.

📒 Files selected for processing (2)
  • src/i18n/locale/de.json
  • src/i18n/locale/en.json
✅ Files skipped from review due to trivial changes (1)
  • src/i18n/locale/de.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/i18n/locale/en.json

📝 Walkthrough

Walkthrough

Adds saved filters persistence for the Discover filter slideover, auto-applies stored filters when appropriate, and adds controls to save or remove the saved filter set. Matching English and German strings were added for the new actions and errors.

Changes

Saved Filters Feature

Layer / File(s) Summary
useSavedFilters hook implementation
src/hooks/useSavedFilters.ts
Defines per-type storage keys, reads and parses saved filters from localStorage with corruption cleanup, and exposes save/remove helpers plus an updateLocalStorage ref.
FilterSlideover integration and UI actions
src/components/Discover/FilterSlideover/index.tsx, src/i18n/locale/en.json, src/i18n/locale/de.json
Loads saved filters into query params when appropriate, adds the save button and updated clear action, adjusts layout, and adds the matching translation strings.

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

Poem

A bunny tucked some filters tight,
Then saved them for another night. 🐰
One hop to store, one hop to clear,
And back they come when filters steer.

🚥 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, persist, and restore behavior for movie and TV filters as requested in issue #369.
Out of Scope Changes check ✅ Passed The changes stay focused on saved filter persistence, UI affordances, and related locale updates.

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
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