Skip to content

Commit

Permalink
group-members-page: Replace toSorted() with shallow copy + sort()
Browse files Browse the repository at this point in the history
I didn't realize that `toSorted` is a relatively new method that is
not supported in older browser versions.¹

Thanks to @tsibley for using an old version of FireFox and catching this.

¹ <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted#browser_compatibility>
  • Loading branch information
joverlee521 committed Aug 21, 2024
1 parent d57a1a1 commit 5729345
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion static-site/src/sections/group-members-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ const MembersTableContainer = styled.div`
`;

const MembersTable = ({ members }: { members: GroupMember[]}) => {
const sortedMembers = members.toSorted((a, b) => a.username.localeCompare(b.username));
const sortedMembers = [...members];
sortedMembers.sort((a, b) => a.username.localeCompare(b.username));
function prettifyRoles(memberRoles: string[]) {
// Prettify the role names by making them singular and capitalized
return memberRoles.map((roleName) => startCase(roleName.replace(/s$/, ''))).join(", ");
Expand Down

0 comments on commit 5729345

Please sign in to comment.