Fix mutation in CallingParticipantList component

This commit is contained in:
Evan Hahn 2020-12-03 11:24:44 -06:00 committed by GitHub
parent 7aaa5ab294
commit 511ad14137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 6 deletions

12
ts/util/sortByTitle.ts Normal file
View file

@ -0,0 +1,12 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
interface HasTitle {
title: string;
}
export function sortByTitle<T extends HasTitle>(
arr: ReadonlyArray<T>
): Array<T> {
return [...arr].sort((a, b) => a.title.localeCompare(b.title));
}