From 955f9c0383cc3acfd0834d80f275ce294e63fd08 Mon Sep 17 00:00:00 2001 From: tomasmaranga Date: Wed, 23 Apr 2025 17:33:02 -0400 Subject: [PATCH] sorted actually --- src/components/VolunteerTable.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/VolunteerTable.tsx b/src/components/VolunteerTable.tsx index 9f151d4..fa67b79 100644 --- a/src/components/VolunteerTable.tsx +++ b/src/components/VolunteerTable.tsx @@ -49,8 +49,15 @@ export default function VolunteerTable({ const isRowSelected = (name: string) => selected?.includes(name); + const sortedUsers = React.useMemo( + () => + [...(users ?? [])].sort((a, b) => a.lastName.localeCompare(b.lastName)), + [users] + ); + const paginatedRows = - users?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) || []; + sortedUsers?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) || + []; useEffect(() => { setPage(0);