Skip to content

Commit

Permalink
UIQM-568 Remove not needed mapping of suggested fields
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanDenis committed Oct 12, 2023
1 parent 5e30bc9 commit fae9c98
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/hooks/useAuthorityLinking/useAuthorityLinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const useAuthorityLinking = ({ tenantId, marcType, action } = {}) => {
const { linkingRules } = useAuthorityLinkingRules({ tenantId: _tenantId });

const {
fetchLinkSuggestions: fetchMemberLinkSuggestions,
isLoading: isLoadingMemberLinkSuggestions,
fetchLinkSuggestions,
isLoading: isLoadingLinkSuggestions,
} = useLinkSuggestions({ tenantId: _tenantId });

const linkableBibFields = useMemo(() => linkingRules.map(rule => rule.bibField), [linkingRules]);
Expand Down Expand Up @@ -217,16 +217,10 @@ const useAuthorityLinking = ({ tenantId, marcType, action } = {}) => {
...extraRequestArgs,
};

const { fields: memberSuggestedFields } = await fetchMemberLinkSuggestions(requestArgs);
const { fields: memberSuggestedFields } = await fetchLinkSuggestions(requestArgs);

return memberSuggestedFields.map((suggestedField) => {
if (suggestedField.linkDetails?.status !== AUTOLINKING_STATUSES.ERROR) {
return suggestedField;
}

return suggestedField;
});
}, [fetchMemberLinkSuggestions]);
return memberSuggestedFields;
}, [fetchLinkSuggestions]);

const autoLinkAuthority = useCallback(async (formValues) => {
const fieldsToLink = formValues.records.filter(record => isRecordForAutoLinking(record, autoLinkableBibFields));
Expand Down Expand Up @@ -352,8 +346,8 @@ const useAuthorityLinking = ({ tenantId, marcType, action } = {}) => {
autoLinkAuthority,
actualizeLinks,
linkingRules,
fetchMemberLinkSuggestions,
isLoadingLinkSuggestions: isLoadingMemberLinkSuggestions,
fetchLinkSuggestions,
isLoadingLinkSuggestions,
};
};

Expand Down

0 comments on commit fae9c98

Please sign in to comment.