diff --git a/awx/ui_next/src/components/Search/Search.js b/awx/ui_next/src/components/Search/Search.js index 8e724136d7..fdcf223084 100644 --- a/awx/ui_next/src/components/Search/Search.js +++ b/awx/ui_next/src/components/Search/Search.js @@ -3,7 +3,7 @@ import React, { Fragment, useState } from 'react'; import PropTypes from 'prop-types'; import { t } from '@lingui/macro'; -import { withRouter } from 'react-router-dom'; +import { useLocation } from 'react-router-dom'; import { Button, ButtonVariant, @@ -36,7 +36,6 @@ function Search({ onReplaceSearch, onRemove, qsConfig, - location, searchableKeys, relatedSearchableKeys, onShowAdvancedSearch, @@ -45,6 +44,7 @@ function Search({ enableNegativeFiltering, enableRelatedFuzzyFiltering, }) { + const location = useLocation(); const [isSearchDropdownOpen, setIsSearchDropdownOpen] = useState(false); const [searchKey, setSearchKey] = useState( (() => { @@ -341,4 +341,4 @@ Search.defaultProps = { enableRelatedFuzzyFiltering: true, }; -export default withRouter(Search); +export default Search; diff --git a/awx/ui_next/src/components/Sort/Sort.js b/awx/ui_next/src/components/Sort/Sort.js index c589ed49cb..fc7374b3f7 100644 --- a/awx/ui_next/src/components/Sort/Sort.js +++ b/awx/ui_next/src/components/Sort/Sort.js @@ -1,7 +1,7 @@ import React, { Fragment, useState } from 'react'; import PropTypes from 'prop-types'; -import { useLocation, withRouter } from 'react-router-dom'; +import { useLocation } from 'react-router-dom'; import { t } from '@lingui/macro'; import { Button, @@ -147,7 +147,4 @@ Sort.defaultProps = { onSort: null, }; -export { Sort as _Sort }; -const Wrapped = withRouter(Sort); -Wrapped.displayName = 'Sort'; -export default Wrapped; +export default Sort; diff --git a/awx/ui_next/src/components/Sort/Sort.test.js b/awx/ui_next/src/components/Sort/Sort.test.js index 5ee3a52a23..d72ab42822 100644 --- a/awx/ui_next/src/components/Sort/Sort.test.js +++ b/awx/ui_next/src/components/Sort/Sort.test.js @@ -6,7 +6,7 @@ import { waitForElement, } from '../../../testUtils/enzymeHelpers'; -import Sort, { _Sort as SortUnwrapped } from './Sort'; +import Sort from './Sort'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -167,7 +167,7 @@ describe('', () => { const numericColumns = [{ name: 'ID', key: 'id' }]; const wrapper = shallow( - ', () => { const numericColumns = [{ name: 'ID', key: 'id' }]; const wrapper = shallow( - ', () => { const alphaColumns = [{ name: 'Name', key: 'name' }]; const wrapper = shallow( - ', () => { const alphaColumns = [{ name: 'Name', key: 'name' }]; const wrapper = shallow( - ', () => { }) ); - jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - useParams: () => ({ - id: 'a', - }), - })); - await act(async () => wrapper.find('SelectableCard[label="Job templates"]').prop('onClick')({ fetchItems: JobTemplatesAPI.read,