Skip to content

Commit 067896a

Browse files
committed
Handle case when there are no providers
Signed-off-by: Olga Bulat <obulat@gmail.com>
1 parent 03dff8a commit 067896a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

frontend/src/utils/provider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import type { MediaProvider } from "~/types/media-provider"
55
* @param data - initial unordered list of providers
66
*/
77
export const sortProviders = (data: MediaProvider[]): MediaProvider[] => {
8+
if (!data.length) {
9+
return []
10+
}
811
return [...data].sort((sourceObjectA, sourceObjectB) => {
912
const nameA = sourceObjectA.source_name.toUpperCase()
1013
const nameB = sourceObjectB.source_name.toUpperCase()

0 commit comments

Comments
 (0)