Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,18 @@ export async function fetchPublishedContractVersions(
),
);

return responses.filter((r) => r.status === "fulfilled").map((r) => r.value);
const publishedContracts = responses
.filter((r) => r.status === "fulfilled")
.map((r) => r.value);

// if there are two published contract with same version, keep the latest (first in list - list is already sorted) one
const uniquePublishedContracts = publishedContracts.filter(
(contract, idx, arr) =>
// if this is the first occurrence of this version in list - keep it
arr.findIndex((c) => c.version === contract.version) === idx,
);

return uniquePublishedContracts;
}

export async function fetchPublishedContractVersion(
Expand Down
Loading