Skip to content

feat(person): add job filter to 'Crew' section#3242

Open
hc-nolan wants to merge 3 commits into
seerr-team:developfrom
hc-nolan:person-filter
Open

feat(person): add job filter to 'Crew' section#3242
hc-nolan wants to merge 3 commits into
seerr-team:developfrom
hc-nolan:person-filter

Conversation

@hc-nolan

@hc-nolan hc-nolan commented Jul 12, 2026

Copy link
Copy Markdown

Description

This commit adds a job filter to the 'Crew' section on /person/[id].

Say I want to download every movie directed by Akira Kurosawa - his /person page has many results where he was not the director, which makes it more difficult to get only the movies I want.

AI usage disclaimer:

  • Used Claude Code to search the repo for existing issues/PRs related to this feature
  • Used Claude Code in a chat-only manner to assist with a few minor errors I ran into (just TS noob stuff)
  • All code was written by hand

How Has This Been Tested?

Ran full test suite locally; all pass. Tested functionality in browser.

Screenshots / Logs (if applicable)

image

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

  • New Features
    • Added a job-type filter to the crew list.
    • Users can choose a specific job type or switch back to viewing all crew.
    • Crew members’ job titles continue to display when available.

@hc-nolan
hc-nolan requested a review from a team as a code owner July 12, 2026 23:50
@coderabbitai

coderabbitai Bot commented Jul 12, 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: d5d56b89-65f4-480c-81fb-2705657c47e6

📥 Commits

Reviewing files that changed from the base of the PR and between faff75a and df6ab99.

📒 Files selected for processing (1)
  • src/components/PersonDetails/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/PersonDetails/index.tsx

📝 Walkthrough

Walkthrough

PersonDetails adds a crew job-type selector, derives available job options from crew data, and filters displayed crew cards while preserving existing job text.

Changes

Crew job filtering

Layer / File(s) Summary
Job filter state and options
src/components/PersonDetails/index.tsx
Tracks the selected job type and derives deduplicated job options from crew data.
Job filter UI and rendering
src/components/PersonDetails/index.tsx
Adds the job selector beside the crew heading and filters crew cards by the selected job or all jobs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a bunny with a crew to sort,
By every job and every port.
Pick “All” or choose one role,
The cards now hop into control.
Carrots cheer the tidy scroll!

🚥 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 accurately summarizes the main change: adding a job filter to the Crew section.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

🧹 Nitpick comments (2)
src/components/PersonDetails/index.tsx (2)

91-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

uniqueJobs memo omits sortedCrew from its dependency array.

The computation reads sortedCrew, but the deps array is [combinedCredits, currentMediaType]. It happens to be correct today only because sortedCrew is memoized on the identical deps and both hooks run in the same render, but this is fragile and violates react-hooks/exhaustive-deps — a future change to sortedCrew's deps would silently desync uniqueJobs.

♻️ Suggested fix
   const uniqueJobs = useMemo(() => {
     return [...new Set(sortedCrew.flatMap((obj) => obj.job.split(', ')))];
-  }, [combinedCredits, currentMediaType]);
+  }, [sortedCrew]);
🤖 Prompt for 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.

In `@src/components/PersonDetails/index.tsx` around lines 91 - 94, Update the
uniqueJobs useMemo dependency array to include sortedCrew, while preserving the
existing job extraction and deduplication logic.

35-36: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Stale currentJobType when currentMediaType changes.

Switching currentMediaType recomputes uniqueJobs from the newly filtered sortedCrew, but currentJobType isn't reset. If the previously selected job (e.g. "Director") no longer exists in the new job list, the <select> shows a value with no matching <option> and the crew list may render empty with no visual indication why.

🔧 Suggested fix (touches the existing, unchanged `mediaTypePicker` handler)
onChange={(e) => {
  setCurrentMediaType(e.target.value as MediaType);
  setCurrentJobType('all');
}}
🤖 Prompt for 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.

In `@src/components/PersonDetails/index.tsx` around lines 35 - 36, Reset
currentJobType to 'all' whenever currentMediaType changes in the existing
mediaTypePicker onChange handler, alongside setCurrentMediaType, so the selected
job remains valid for the newly computed job options.
🤖 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/PersonDetails/index.tsx`:
- Around line 238-243: Update the crew filter in the sortedCrew rendering to
compare currentJobType against exact entries in media.job, splitting the
comma-joined job string using its existing delimiter before checking membership.
Preserve the currentJobType === 'all' behavior and exclude partial matches such
as “Producer” matching “Executive Producer”.
- Around line 180-183: Update the job filter options in the PersonDetails
component to use intl.formatMessage(globalMessages.all) for the “all” label,
matching mediaTypePicker, and add a stable key prop to each mapped option using
the job value.

---

Nitpick comments:
In `@src/components/PersonDetails/index.tsx`:
- Around line 91-94: Update the uniqueJobs useMemo dependency array to include
sortedCrew, while preserving the existing job extraction and deduplication
logic.
- Around line 35-36: Reset currentJobType to 'all' whenever currentMediaType
changes in the existing mediaTypePicker onChange handler, alongside
setCurrentMediaType, so the selected job remains valid for the newly computed
job options.
🪄 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: 7bc6068e-6603-41f7-8ec6-de8dccaf3b1e

📥 Commits

Reviewing files that changed from the base of the PR and between 5ae70d0 and faff75a.

📒 Files selected for processing (1)
  • src/components/PersonDetails/index.tsx

Comment thread src/components/PersonDetails/index.tsx Outdated
Comment thread src/components/PersonDetails/index.tsx
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