mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 18:42:34 +01:00
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
This commit is contained in:
@@ -134,7 +134,9 @@ export function resolveRomArtwork(rom: DetailedRom): RomArtworkEntry[] {
|
||||
isVideo,
|
||||
};
|
||||
})
|
||||
.filter((entry) => entry !== null);
|
||||
.filter((entry): entry is NonNullable<typeof entry> => 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;
|
||||
|
||||
Reference in New Issue
Block a user