Skip to content

Commit

Permalink
fix(openalex): Display no affiliations if no results from OpenAlex
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Jan 17, 2025
1 parent 63a8720 commit 95151bf
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions client/src/pages/openalex-affiliations/results/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default function Affiliations() {
const [rorMessage, setRorMessage] = useState('');
const [rorMessageType, setRorMessageType] = useState('');
const [rorsToRemove, setRorsToRemove] = useState([]);
const [stepsEnabledList, setStepsEnabledList] = useState(false);
const [uniqueRors, setUniqueRors] = useState({});

const toggleRemovedRor = (affiliationId, rorId) => {
Expand Down Expand Up @@ -214,7 +213,7 @@ export default function Affiliations() {
});

useEffect(() => {
const get = async () => {
const getUniquesRors = async () => {
const addedRors = await Promise.all(
addList.map((add) => getRorData(add)),
);
Expand All @@ -227,7 +226,7 @@ export default function Affiliations() {
setUniqueRors({ ...uniqueRors, ...uniqueRorsTmp });
};

get();
getUniquesRors();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [addList]);

Expand Down Expand Up @@ -791,18 +790,14 @@ export default function Affiliations() {
/>
</div>
</div>
{filteredAffiliations.length === 0 ? (
<Spinner size={48} /> // TODO replace spinner by skeleton
) : (
<ListView
affiliationsCount={affiliations.length}
filteredAffiliations={filteredAffiliations}
removeRorFromAddList={removeRorFromAddList}
setFilteredAffiliationName={setFilteredAffiliationName}
setSelectAffiliations={setSelectAffiliations}
toggleRemovedRor={toggleRemovedRor}
/>
)}
<ListView
affiliationsCount={affiliations.length}
filteredAffiliations={filteredAffiliations}
removeRorFromAddList={removeRorFromAddList}
setFilteredAffiliationName={setFilteredAffiliationName}
setSelectAffiliations={setSelectAffiliations}
toggleRemovedRor={toggleRemovedRor}
/>
</div>
</Col>
</Row>
Expand Down

0 comments on commit 95151bf

Please sign in to comment.