diff --git a/src/pages/user_profile/AffiliationAndRoles.js b/src/pages/user_profile/AffiliationAndRoles.js index 764c99ab4..881601e42 100644 --- a/src/pages/user_profile/AffiliationAndRoles.js +++ b/src/pages/user_profile/AffiliationAndRoles.js @@ -123,54 +123,52 @@ export default function AffiliationAndRole(props) { const generateInstitutionSelectionDisplay = () => { if (!isSigningOfficial() || (isNil(profile.institutionId) && isNil(profile.suggestedInstitution))) { return
- - { - return { - institutionId: i.id, - displayText: i.name, - }; - })} - placeholder='Search for Institution...' - isCreatable={true} - defaultValue={{ - institutionId: selectedInstitution?.institutionId, - suggestedInstitution: profile.suggestedInstitution, - displayText: ( - (!isNil(selectedInstitution) - ? `${selectedInstitution.name}` - : (!isNil(profile.suggestedInstitution) - ? `${profile.suggestedInstitution}` - : '')) - ), - }} - selectConfig={{ - clearValue: () => { - setProfile(Object.assign({}, - profile, - { - institutionId: undefined, - suggestedInstitution: undefined - })); - }, - }} - onChange={({ value }) => { - if (!isNil(value?.institutionId)) { - setProfile(Object.assign({}, profile, { - institutionId: value?.institutionId, - suggestedInstitution: undefined - })); - } else { - setProfile(Object.assign({}, profile, { + { + return { + institutionId: i.id, + displayText: i.name, + }; + })} + placeholder='Search for Institution...' + isCreatable={true} + defaultValue={{ + institutionId: selectedInstitution?.institutionId, + suggestedInstitution: profile.suggestedInstitution, + displayText: ( + (!isNil(selectedInstitution) + ? `${selectedInstitution.name}` + : (!isNil(profile.suggestedInstitution) + ? `${profile.suggestedInstitution}` + : '')) + ), + }} + selectConfig={{ + clearValue: () => { + setProfile(Object.assign({}, + profile, + { institutionId: undefined, - suggestedInstitution: value?.displayText + suggestedInstitution: undefined })); - } - }} > - - + }, + }} + onChange={({ value }) => { + if (!isNil(value?.institutionId)) { + setProfile(Object.assign({}, profile, { + institutionId: value?.institutionId, + suggestedInstitution: undefined + })); + } else { + setProfile(Object.assign({}, profile, { + institutionId: undefined, + suggestedInstitution: value?.displayText + })); + } + }} > +
; } else { let institution = (profile.institutionId ? find(institutions, { id: profile.institutionId }) : null); @@ -227,7 +225,7 @@ export default function AffiliationAndRole(props) { -
+