From 80a1ea18f8e524cb48574efeabc48d72198e4ab1 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 7 Jul 2026 11:00:13 -0400 Subject: [PATCH] fix(v2): order artwork images before videos, narrow filter with type guard Sort library media so image entries precede video entries (stable sort keeps original order within each group), and use a type-predicate filter so the result stays typed as RomArtworkEntry[]. Generated-By: PostHog Code Task-Id: fad7faa2-a17e-4583-a816-1b9915ba138f --- frontend/src/v2/utils/romArtwork.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/v2/utils/romArtwork.ts b/frontend/src/v2/utils/romArtwork.ts index 867a35211..703aea748 100644 --- a/frontend/src/v2/utils/romArtwork.ts +++ b/frontend/src/v2/utils/romArtwork.ts @@ -134,7 +134,9 @@ export function resolveRomArtwork(rom: DetailedRom): RomArtworkEntry[] { isVideo, }; }) - .filter((entry) => entry !== null); + .filter((entry): entry is NonNullable => entry !== null) + // Images before videos; sort is stable so original order holds within each group. + .sort((a, b) => Number(a.isVideo) - Number(b.isVideo)); for (const def of artworkDefs) { if (!def.url || seen.has(def.url)) continue;