Skip to content

Commit

Permalink
feat: Remove repeated linked wearables
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio committed Oct 1, 2024
1 parent 094124a commit a011d27
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/logic/fetch-elements/fetch-third-party-wearables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,17 @@ async function _fetchThirdPartyWearables(
fetchThirdPartyV2(providersV2)
])

return [...thirdPartyV1, ...thirdPartyV2]
const allThirdPartyWearables = [...thirdPartyV1, ...thirdPartyV2]
const thirdPartyWearablesByUrn = allThirdPartyWearables.reduce(
(acc, tpw) => {
// If there are repeated wearables, we should merge them
acc[tpw.urn] = tpw
return acc
},
{} as Record<string, ThirdPartyWearable>
)

return Object.values(thirdPartyWearablesByUrn)
}

export async function fetchThirdPartyWearablesFromThirdPartyName(
Expand Down

0 comments on commit a011d27

Please sign in to comment.