Targets page: fix validators sorting (#6886)

Co-authored-by: dmitry@fleetonomy.io <dmitry@fleetonomy.io>
This commit is contained in:
Dmytro Filippov 2022-01-26 14:00:35 +02:00 committed by GitHub
parent a957898897
commit a9ff87ebf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,7 +138,9 @@ function applyFilter (validators: ValidatorInfo[], medianComm: number, allIdenti
}
function sort (sortBy: TargetSortBy, sortFromMax: boolean, validators: ValidatorInfo[]): ValidatorInfo[] {
// Use slice to create new array, so that sorting triggers component render
return validators
.slice(0)
.sort((a, b) => sortFromMax
? a[sortBy] - b[sortBy]
: b[sortBy] - a[sortBy]