Skip to content

fix(external-link): replace TMDB ID with IMDB ID for Trakt links#2934

Merged
0xSysR3ll merged 1 commit intoseerr-team:developfrom
tiagodefendi:develop
Apr 24, 2026
Merged

fix(external-link): replace TMDB ID with IMDB ID for Trakt links#2934
0xSysR3ll merged 1 commit intoseerr-team:developfrom
tiagodefendi:develop

Conversation

@tiagodefendi
Copy link
Copy Markdown
Contributor

@tiagodefendi tiagodefendi commented Apr 22, 2026

Description

Trakt's V3 migration broke the search URL (/search/tmdb/{id}) for free users, redirecting them to the homepage instead of the media page.

Switch to using IMDB with direct V3-compatible URLs:

How Has This Been Tested?

  • Build & Setup: Project built successfully locally and initial setup completed without issues.
  • Manual Verification: Verified the fix by clicking the Trakt icon on both movie and TV show pages. Confirmed that links now navigate directly to the specific Trakt media page, resolving the previous issue where it redirected to the homepage.
  • Automated Tests: All test suites were executed and passed successfully using the pnpm test command.

Screenshots

Screenshot from 2026-04-22 13-28-19 Screenshot from 2026-04-22 13-28-32 Screenshot from 2026-04-22 13-29-04 Screenshot from 2026-04-22 13-29-13

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

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Trakt external link resolution. Links for movies and shows now use IMDb identifiers to connect directly to the correct content pages on Trakt, providing improved navigation reliability and ensuring users consistently reach their intended external references.

…Trakt links

Trakt's V3 migration broke the search URL (/search/tmdb/{id}) for free users, redirecting them to
the homepage instead od te media page.

fix seerr-team#2773
@tiagodefendi tiagodefendi requested a review from a team as a code owner April 22, 2026 16:55
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

📝 Walkthrough

Walkthrough

The PR fixes broken Trakt links by replacing the Trakt link rendering condition from using tmdbId with a TMDb search query to using imdbId with direct IMDb-based URLs. This resolves the issue where Trakt links were redirecting to the home page instead of the intended media page.

Changes

Cohort / File(s) Summary
Trakt Link URL Fix
src/components/ExternalLinkBlock/index.tsx
Changed Trakt link condition from tmdbId to imdbId and updated URL from TMDb search endpoint (https://trakt.tv/search/tmdb/{tmdbId}) to direct IMDb-based URL (https://trakt.tv/{movies|shows}/{imdbId}).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • M0NsTeRRR
  • fallenbagel

Poem

🐰 A Trakt link was broken, lost in the void,
Pointing to searches that left us annoyed,
Now IMDb IDs light the way true,
Direct paths to movies—refreshed and new!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR directly addresses issue #2773 by switching from broken TMDB search URLs to IMDb-based direct Trakt URLs, ensuring media pages load correctly instead of redirecting to homepage.
Out of Scope Changes check ✅ Passed Changes are focused solely on fixing Trakt link rendering and URL construction in ExternalLinkBlock, directly addressing the linked issue objective with no extraneous modifications.
Title check ✅ Passed The title accurately describes the main change: replacing TMDB ID with IMDB ID for Trakt links in the external link component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/ExternalLinkBlock/index.tsx (1)

106-117: ⚠️ Potential issue | 🔴 Critical

Trakt link URLs are broken—imdbId cannot be used directly as a URL slug.

Trakt.tv URLs require slugs in the format title-year (e.g., trakt.tv/movies/the-martian-2015), not raw IMDb IDs. While the Trakt API supports IMDb lookups via /search/imdb/{id}, the frontend website does not accept direct IMDb ID slugs. The current code will generate URLs like https://trakt.tv/movies/tt0111161 that return 404 errors.

To fix this, either:

  1. Use Trakt's search endpoint: https://trakt.tv/search/imdb/{imdbId}
  2. Obtain and use the Trakt slug from metadata (if available)
  3. Revert to a working method if TMDB search flow was previously functional
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ExternalLinkBlock/index.tsx` around lines 106 - 117, The Trakt
link in ExternalLinkBlock is using imdbId as a URL slug which causes 404s;
update the href construction in the JSX that renders the Trakt <a> (the block
checking imdbId && mediaType !== 'person' that currently builds
`https://trakt.tv/${mediaType === 'movie' ? 'movies' : 'shows'}/${imdbId}`) to
instead use Trakt's IMDb search URL (`https://trakt.tv/search/imdb/{imdbId}`),
or if your component/props include a precomputed Trakt slug (e.g., traktSlug or
metadata.traktSlug), prefer using that slug for `trakt.tv/movies/{slug}` or
`trakt.tv/shows/{slug}`; ensure the change still uses mediaType to choose movies
vs shows and preserves target="_blank" and rel attributes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/ExternalLinkBlock/index.tsx`:
- Around line 106-117: The Trakt link in ExternalLinkBlock is using imdbId as a
URL slug which causes 404s; update the href construction in the JSX that renders
the Trakt <a> (the block checking imdbId && mediaType !== 'person' that
currently builds `https://trakt.tv/${mediaType === 'movie' ? 'movies' :
'shows'}/${imdbId}`) to instead use Trakt's IMDb search URL
(`https://trakt.tv/search/imdb/{imdbId}`), or if your component/props include a
precomputed Trakt slug (e.g., traktSlug or metadata.traktSlug), prefer using
that slug for `trakt.tv/movies/{slug}` or `trakt.tv/shows/{slug}`; ensure the
change still uses mediaType to choose movies vs shows and preserves
target="_blank" and rel attributes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a92e9ab5-5232-4661-8d6d-ccb5edfc49e0

📥 Commits

Reviewing files that changed from the base of the PR and between 431ad91 and 0448115.

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

@gauthier-th gauthier-th requested a review from Copilot April 22, 2026 17:42
@gauthier-th gauthier-th changed the title fix(external-link-block-trakt-url): replace TMDB ID with IMDB ID for Trakt links fix(external-link): replace TMDB ID with IMDB ID for Trakt links Apr 22, 2026
@seerr-automation-bot seerr-automation-bot added this to the v3.3.0 milestone Apr 22, 2026
Copy link
Copy Markdown
Contributor

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

Updates the Trakt external link generation in the UI to avoid the deprecated/broken TMDB-search-based Trakt URLs and instead link directly to Trakt movie/show pages via IMDb IDs, resolving the redirect-to-homepage issue reported in #2773.

Changes:

  • Switch Trakt links from /search/tmdb/{tmdbId} to direct /movies/{imdbId} and /shows/{imdbId} URLs.
  • Gate Trakt link rendering on imdbId availability (instead of tmdbId) for non-person media.

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

Copy link
Copy Markdown
Contributor

@0xSysR3ll 0xSysR3ll left a comment

Choose a reason for hiding this comment

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

LGTM

@0xSysR3ll 0xSysR3ll merged commit f078da8 into seerr-team:develop Apr 24, 2026
21 checks passed
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.

Trakt links are broken

5 participants