sort chains (#637)

This commit is contained in:
Thibaut Sardan 2021-01-28 18:06:15 +01:00 committed by GitHub
parent 3ef82e8890
commit 30d87761ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,8 +32,16 @@ export default function (): Option[] {
...chains.map(({ chain, genesisHash }) => ({
text: chain,
value: genesisHash
})),
...metadataChains.filter(({ value }) => !chains.find(({ genesisHash }) => genesisHash === value))
}))
.concat(
// get any chain present in the metadata and not already part of chains
...metadataChains.filter(
({ value }) => {
return !chains.find(
({ genesisHash }) => genesisHash === value);
}
))
.sort((a, b) => a.text.localeCompare(b.text))
], [metadataChains, t]);
return hashes;