diff --git a/client/src/pages/openalex-affiliations/results/index.jsx b/client/src/pages/openalex-affiliations/results/index.jsx index 12cc989..1cde0d2 100644 --- a/client/src/pages/openalex-affiliations/results/index.jsx +++ b/client/src/pages/openalex-affiliations/results/index.jsx @@ -19,7 +19,6 @@ import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'; import { status } from '../../../config'; import useToast from '../../../hooks/useToast'; import Header from '../../../layout/header'; -import { getAffiliationsCorrections } from '../../../utils/curations'; import getFlagEmoji from '../../../utils/flags'; import { getRorData, isRor } from '../../../utils/ror'; import { normalize, removeDiacritics } from '../../../utils/strings'; @@ -42,7 +41,6 @@ export default function Affiliations() { const [addList, setAddList] = useState([]); const [affiliations, setAffiliations] = useState([]); - const [allOpenalexCorrections, setAllOpenalexCorrections] = useState([]); // TODO: ?? const [body, setBody] = useState({}); const [cleanRor, setCleanRor] = useState(''); const [filteredAffiliationName, setFilteredAffiliationName] = useState(''); @@ -177,16 +175,9 @@ export default function Affiliations() { `${affiliation.key.replace('[ source: ', '').replace(' ]', '')} ${affiliation.rors.map((_ror) => _ror.rorId).join(' ')}`, ), ); - // Recompute corrections only when the array has changed - if (filteredAffiliationsTmp.length !== filteredAffiliations.length) { - setAllOpenalexCorrections([ - ...allOpenalexCorrections, - ...getAffiliationsCorrections(filteredAffiliationsTmp), - ]); - } setFilteredAffiliations(filteredAffiliationsTmp); setIsLoading(false); - }, [affiliations, allOpenalexCorrections, filteredAffiliationName, filteredAffiliations.length, filteredStatus]); + }, [affiliations, filteredAffiliationName]); useEffect(() => { if (ror === '') { diff --git a/client/src/utils/curations.jsx b/client/src/utils/curations.jsx index c156c61..998da15 100644 --- a/client/src/utils/curations.jsx +++ b/client/src/utils/curations.jsx @@ -1,13 +1,3 @@ -const getAffiliationsCorrections = (affiliations) => affiliations - .filter((affiliation) => affiliation.hasCorrection) - .map((affiliation) => ({ - id: affiliation.id, - rawAffiliationString: affiliation.name, - rorsInOpenAlex: affiliation.rors, - worksExample: affiliation.worksExample, - worksOpenAlex: affiliation.worksOpenAlex, - })); - const getMentionsCorrections = (mentions) => mentions .filter((mention) => mention.hasCorrection) .map((mention) => { @@ -61,4 +51,4 @@ const getMentionsCorrections = (mentions) => mentions }) .flat(); -export { getAffiliationsCorrections, getMentionsCorrections }; +export { getMentionsCorrections };