1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-26 07:51:36 +00:00

sort the accounts array

This commit is contained in:
slowbackspace 2019-04-09 17:15:01 +02:00
parent 813edd442b
commit 715da870a7

View File

@ -75,6 +75,8 @@ const createAccount = (state: State, account: Account): State => {
}
const newState: State = [...state];
newState.push(account);
// sort the accounts array so the imported accounts always come before discovered accounts
newState.sort((a, b) => b.imported - a.imported || a.index - b.index);
return newState;
};