Skip to content

Commit 37ce472

Browse files
authored
🔧 Fix cert modal (#722)
1 parent 0465a62 commit 37ce472

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/organisms/CertificationModal.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ const CertificationModal = ({
3232
const [hasExpiryDate, setHasExpiryDate] = useState<boolean>(
3333
editMode && !!userCertificationRef.to
3434
);
35+
const sortedCerts = certificationsRef
36+
? certificationsRef.sort((a, b) =>
37+
a.certBody + a.name > b.certBody + b.name ? 1 : -1
38+
)
39+
: [];
3540

3641
return (
3742
<div className="flex flex-col max-h-75vh p-2 w-full">
@@ -77,9 +82,7 @@ const CertificationModal = ({
7782
<CustomSelect
7883
labelFn={(cert) => `${cert?.certBody} - ${cert?.name}`}
7984
keyFn={(cert) => cert.id}
80-
choices={certificationsRef.sort((a, b) =>
81-
a.certBody + a.name > b.certBody + b.name ? 1 : -1
82-
)}
85+
choices={sortedCerts}
8386
selectedChoice={userCertification?.Certification}
8487
placeholder={t("userProfile.certModal.selectCert")}
8588
readOnly={editMode}

0 commit comments

Comments
 (0)