From 6a9236aada153ceff9e1ac66a59cd9bb081e1be6 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 16 Jul 2026 18:40:44 -0400 Subject: [PATCH] fix(v2): link IGDB provider to game page by slug The IGDB provider link built a text-search URL from the numeric ID, which returns no results. Point it at the canonical /games/ page when the slug is present, falling back to the ID search otherwise. The URL builder now receives the DetailedRom so it can reach fields beyond the provider ID. Generated-By: PostHog Code Task-Id: 6843b623-ed80-454f-8373-8192f3c629b4 --- .../src/v2/components/GameDetails/OverviewTab.vue | 2 +- .../src/v2/components/GameDetails/ProviderGrid.vue | 2 +- .../src/v2/components/GameDetails/providers.ts | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/v2/components/GameDetails/OverviewTab.vue b/frontend/src/v2/components/GameDetails/OverviewTab.vue index 815d0d6a9..c0bbfc761 100644 --- a/frontend/src/v2/components/GameDetails/OverviewTab.vue +++ b/frontend/src/v2/components/GameDetails/OverviewTab.vue @@ -133,7 +133,7 @@ const dataProviders = computed(() => PROVIDERS.map((p) => { const id = providerId(props.rom, p); if (id === null) return null; - return { name: p.name, href: p.url ? p.url(id) : null }; + return { name: p.name, href: p.url ? p.url(id, props.rom) : null }; }).filter((e): e is { name: string; href: string | null } => e !== null), ); diff --git a/frontend/src/v2/components/GameDetails/ProviderGrid.vue b/frontend/src/v2/components/GameDetails/ProviderGrid.vue index 37506ce30..6901afeaa 100644 --- a/frontend/src/v2/components/GameDetails/ProviderGrid.vue +++ b/frontend/src/v2/components/GameDetails/ProviderGrid.vue @@ -27,7 +27,7 @@ const entries = computed(() => { accent: p.color, logo: p.logo, id, - href: id !== null && p.url ? p.url(id) : null, + href: id !== null && p.url ? p.url(id, props.rom) : null, }; }); // Linked first; the cards know how to dim themselves when unlinked. diff --git a/frontend/src/v2/components/GameDetails/providers.ts b/frontend/src/v2/components/GameDetails/providers.ts index 412abe22f..f594c8967 100644 --- a/frontend/src/v2/components/GameDetails/providers.ts +++ b/frontend/src/v2/components/GameDetails/providers.ts @@ -13,8 +13,10 @@ export type Provider = { color: string; /** Optional favicon for the provider's identity. */ logo: string | null; - /** Optional URL builder; when null the card renders unlinked. */ - url: ((id: string | number) => string) | null; + /** Optional URL builder; when null the card renders unlinked. The ROM is + * passed so builders can reach fields beyond the provider ID (e.g. IGDB + * links by slug, not by numeric ID). */ + url: ((id: string | number, rom: DetailedRom) => string) | null; }; export const PROVIDERS: Provider[] = [ @@ -23,7 +25,13 @@ export const PROVIDERS: Provider[] = [ name: "IGDB", color: "var(--r-color-provider-igdb)", logo: "/assets/scrappers/igdb.png", - url: (id) => `https://www.igdb.com/search?type=1&q=${id}`, + // IGDB game pages live at /games/; the numeric ID only feeds a text + // search that returns nothing. Fall back to the ID search when the slug + // (populated from the IGDB match) is missing. + url: (id, rom) => + rom.slug + ? `https://www.igdb.com/games/${rom.slug}` + : `https://www.igdb.com/search?type=1&q=${id}`, }, { key: "moby_id",