Fix role ordering (#789)

* fix role order in picker

* one of these sorts will flip it omg

* fix role list

* revert forced role sort in api
This commit is contained in:
41666 2023-05-28 11:15:44 -04:00 committed by GitHub
parent 33a8a0048f
commit 45a1f45055
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 18 deletions

View file

@ -1,8 +1,9 @@
import { Popover } from '@roleypoly/design-system/atoms/popover';
import { Role } from '@roleypoly/design-system/atoms/role';
import { RoleSearch } from '@roleypoly/design-system/molecules/role-search';
import { sortBy } from '@roleypoly/misc-utils/sortBy';
import { Role as RoleT } from '@roleypoly/types';
import { sortBy, uniq } from 'lodash';
import { uniq } from 'lodash';
import React from 'react';
import { GoPlus } from 'react-icons/go';
import { AddRoleButton, EditableRoleListStyled } from './EditableRoleList.styled';
@ -38,7 +39,9 @@ export const EditableRoleList = (props: Props) => {
<>
{sortBy(
props.roles.filter((r) => props.selectedRoles.includes(r.id)),
'position'
'position',
undefined,
true
).map((role) => (
<Role
key={role.id}

View file

@ -47,7 +47,7 @@ export const PickerCategory = (props: CategoryProps) => (
)}
</Head>
<Category>
{sortBy(props.roles, 'position').map((role, idx) => (
{sortBy(props.roles, 'position', undefined, true).map((role, idx) => (
<Container key={idx}>
<Role
role={role}