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 c7d9a0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 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,7 @@ const MembersTableContainer = styled.div`
`;

const MembersTable = ({ members }: { members: GroupMember[]}) => {
const sortedMembers = members.toSorted((a, b) => a.username.localeCompare(b.username));
const sortedMembers = [...members].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 c7d9a0b

Please sign in to comment.