From b0a3b960cc20cd4bc81c47ff67b1fd7af4ad7ad5 Mon Sep 17 00:00:00 2001 From: Bauke Date: Fri, 7 Jan 2022 22:32:34 +0100 Subject: [PATCH] Filter out duplicate known links (#10). --- source/ts/utilities/release.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/ts/utilities/release.ts b/source/ts/utilities/release.ts index 910d997..aad61ec 100644 --- a/source/ts/utilities/release.ts +++ b/source/ts/utilities/release.ts @@ -50,8 +50,9 @@ export default class Release { ? `https://coverartarchive.org/release/${mbid}/front-500` : undefined; - const links = data.relations - .map(({url}) => new RelationLink(url.resource)) + const relations = new Set(data.relations.map(({url}) => url.resource)); + const links = Array.from(relations) + .map((url) => new RelationLink(url)) .sort((a, b) => a.text.localeCompare(b.text)); return new Release({