From c2b56ed74544d990e1c3ab221cf2f53a911805fa Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 12 Jul 2024 14:20:31 +0300 Subject: [PATCH] biomed2 --- src/components/Views/AllAuthors/AllAuthors.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Views/AllAuthors/AllAuthors.tsx b/src/components/Views/AllAuthors/AllAuthors.tsx index 77c5ccdc..1a90d7d6 100644 --- a/src/components/Views/AllAuthors/AllAuthors.tsx +++ b/src/components/Views/AllAuthors/AllAuthors.tsx @@ -45,7 +45,7 @@ export const AllAuthors = (props: Props) => { let sortedAuthors = [...(props.authors || authorsSorted())] // Clone the array to avoid mutating the original console.log('Before Sorting:', sortedAuthors.slice(0, 5)) // Log the first 5 authors for comparison if (searchParams.by === 'name') { - sortedAuthors = sortedAuthors.sort((a, b) => a.name.localeCompare(b.name)) + sortedAuthors = sortedAuthors.sort((a, b) => (a.name||'').localeCompare(b.name||'')) console.log('Sorted by Name:', sortedAuthors.slice(0, 5)) } else if (searchParams.by === 'shouts') { sortedAuthors = sortedAuthors.sort((a, b) => (b.stat?.shouts || 0) - (a.stat?.shouts || 0))