feat(person): add job filter to 'Crew' section#3242
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesCrew job filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/components/PersonDetails/index.tsx (2)
91-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
uniqueJobsmemo omitssortedCrewfrom its dependency array.The computation reads
sortedCrew, but the deps array is[combinedCredits, currentMediaType]. It happens to be correct today only becausesortedCrewis memoized on the identical deps and both hooks run in the same render, but this is fragile and violatesreact-hooks/exhaustive-deps— a future change tosortedCrew's deps would silently desyncuniqueJobs.♻️ 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 winStale
currentJobTypewhencurrentMediaTypechanges.Switching
currentMediaTyperecomputesuniqueJobsfrom the newly filteredsortedCrew, butcurrentJobTypeisn'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
📒 Files selected for processing (1)
src/components/PersonDetails/index.tsx
Prevents a filter of 'Producer' matching on 'Executive Producer'
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
/personpage has many results where he was not the director, which makes it more difficult to get only the movies I want.AI usage disclaimer:
How Has This Been Tested?
Ran full test suite locally; all pass. Tested functionality in browser.
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit