From 744a62bee9dcec7819104bcca6d4d6dda848a68e Mon Sep 17 00:00:00 2001 From: vashjs Date: Wed, 14 Feb 2024 22:42:06 +0100 Subject: [PATCH] remove unused variables + redundant fn --- .../NoResultsMessage/NoResultsMessage.js | 15 +++------------ .../IdentifierTab/IdentifierTab.js | 2 +- .../BulkEditListSidebar/QueryTab/QueryTab.js | 8 +------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/components/BulkEditList/BulkEditListResult/NoResultsMessage/NoResultsMessage.js b/src/components/BulkEditList/BulkEditListResult/NoResultsMessage/NoResultsMessage.js index aa327407..003409f9 100644 --- a/src/components/BulkEditList/BulkEditListResult/NoResultsMessage/NoResultsMessage.js +++ b/src/components/BulkEditList/BulkEditListResult/NoResultsMessage/NoResultsMessage.js @@ -11,8 +11,7 @@ export const NoResultsMessage = () => { const { criteria, identifier, - capabilities, - queryRecordType, + currentRecordType, } = useSearchParams(); const message = useMemo(() => { @@ -28,16 +27,8 @@ export const NoResultsMessage = () => { return ''; }; - const getKey = () => { - if (criteria === CRITERIA.QUERY) { - return queryRecordType; - } - - return capabilities; - }; - - return ; - }, [identifier, criteria, capabilities, queryRecordType]); + return ; + }, [identifier, criteria, currentRecordType]); return ( <> diff --git a/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js b/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js index be43ab1c..d66a0343 100644 --- a/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js +++ b/src/components/BulkEditList/BulkEditListSidebar/IdentifierTab/IdentifierTab.js @@ -139,7 +139,7 @@ export const IdentifierTab = () => { step: EDITING_STEPS.UPLOAD, }); - if (errorMessage.includes(ERRORS.TOKEN)) throw Error(ERRORS.TOKEN); + if (errorMessage?.includes(ERRORS.TOKEN)) throw Error(ERRORS.TOKEN); if (status === JOB_STATUSES.FAILED) throw Error(); history.replace({ diff --git a/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js b/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js index ba108a46..26ab9d8d 100644 --- a/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js +++ b/src/components/BulkEditList/BulkEditListSidebar/QueryTab/QueryTab.js @@ -1,4 +1,4 @@ -import React, { useContext } from 'react'; +import React from 'react'; import { useHistory, useLocation @@ -17,7 +17,6 @@ import { } from '../../../../hooks'; import { getCapabilityOptions } from '../../../../utils/helpers'; import { CRITERIA, QUERY_FILTERS } from '../../../../constants'; -import { RootContext } from '../../../../context/RootContext'; export const QueryTab = () => { const history = useHistory(); @@ -28,7 +27,6 @@ export const QueryTab = () => { step, initialFileName } = useSearchParams(); - const { setVisibleColumns } = useContext(RootContext); const { recordTypes } = useRecordTypes(); const permissions = useBulkPermissions(); const { @@ -71,12 +69,8 @@ export const QueryTab = () => { pathname: '/bulk-edit', search: buildSearch({ queryRecordType: e.target.value, - step: null, - fileName: null, }, history.location.search), }); - - setVisibleColumns(null); }; const onQueryRunSuccess = ({ id }) => {