From fae9c985c329f768425755f9d6d0a8a3c9214910 Mon Sep 17 00:00:00 2001 From: Denys Bohdan Date: Thu, 12 Oct 2023 13:30:25 +0200 Subject: [PATCH] UIQM-568 Remove not needed mapping of suggested fields --- .../useAuthorityLinking.js | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/hooks/useAuthorityLinking/useAuthorityLinking.js b/src/hooks/useAuthorityLinking/useAuthorityLinking.js index e9bce47b..1ef8d26e 100644 --- a/src/hooks/useAuthorityLinking/useAuthorityLinking.js +++ b/src/hooks/useAuthorityLinking/useAuthorityLinking.js @@ -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]); @@ -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)); @@ -352,8 +346,8 @@ const useAuthorityLinking = ({ tenantId, marcType, action } = {}) => { autoLinkAuthority, actualizeLinks, linkingRules, - fetchMemberLinkSuggestions, - isLoadingLinkSuggestions: isLoadingMemberLinkSuggestions, + fetchLinkSuggestions, + isLoadingLinkSuggestions, }; };