File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
apps/dashboard/src/components/contract-components Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,18 @@ export async function fetchPublishedContractVersions(
47
47
) ,
48
48
) ;
49
49
50
- return responses . filter ( ( r ) => r . status === "fulfilled" ) . map ( ( r ) => r . value ) ;
50
+ const publishedContracts = responses
51
+ . filter ( ( r ) => r . status === "fulfilled" )
52
+ . map ( ( r ) => r . value ) ;
53
+
54
+ // if there are two published contract with same version, keep the latest (first in list - list is already sorted) one
55
+ const uniquePublishedContracts = publishedContracts . filter (
56
+ ( contract , idx , arr ) =>
57
+ // if this is the first occurrence of this version in list - keep it
58
+ arr . findIndex ( ( c ) => c . version === contract . version ) === idx ,
59
+ ) ;
60
+
61
+ return uniquePublishedContracts ;
51
62
}
52
63
53
64
export async function fetchPublishedContractVersion (
You can’t perform that action at this time.
0 commit comments