From 6087de5004815bebd6f22cc5759e73a0fb9c615c Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Wed, 17 Jan 2024 14:27:11 +0100 Subject: [PATCH] deps(Algolia): upgrade React InstantSearch --- app/App.jsx | 2 +- app/components/Search/IndexSearchEntriesCount.js | 2 +- app/components/Search/SearchBox.js | 2 +- app/components/Search/SearchPage.js | 12 +++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/App.jsx b/app/App.jsx index 4c51e95f7..9b4d2816e 100644 --- a/app/App.jsx +++ b/app/App.jsx @@ -6,7 +6,7 @@ import { ApolloProvider } from '@apollo/client' // Import libs import React from 'react' import { I18nextProvider } from 'react-i18next' -import { Configure, Index, InstantSearch } from 'react-instantsearch-dom' +import { Configure, Index, InstantSearch } from 'react-instantsearch' import { Provider as ReduxProvider } from 'react-redux' import { polyfill as smoothSrollPolyfill } from 'smoothscroll-polyfill' import { ThemeProvider } from 'styled-components' diff --git a/app/components/Search/IndexSearchEntriesCount.js b/app/components/Search/IndexSearchEntriesCount.js index b8292818d..43da84d92 100644 --- a/app/components/Search/IndexSearchEntriesCount.js +++ b/app/components/Search/IndexSearchEntriesCount.js @@ -1,7 +1,7 @@ import { get } from 'lodash' import PropTypes from 'prop-types' import React from 'react' -import { connectStateResults, Index } from 'react-instantsearch-dom' +import { connectStateResults, Index } from 'react-instantsearch' const SearchResultsCount = connectStateResults(({ searchResults }) => { return get(searchResults, 'nbHits', 0) diff --git a/app/components/Search/SearchBox.js b/app/components/Search/SearchBox.js index 0f00a377e..f0ff6ab0f 100644 --- a/app/components/Search/SearchBox.js +++ b/app/components/Search/SearchBox.js @@ -1,6 +1,6 @@ import React from 'react' import { withNamespaces } from 'react-i18next' -import { SearchBox as AlgoliaSearchBox } from 'react-instantsearch-dom' +import { SearchBox as AlgoliaSearchBox } from 'react-instantsearch' import { withRouter } from 'react-router' import styled from 'styled-components' diff --git a/app/components/Search/SearchPage.js b/app/components/Search/SearchPage.js index bb0217ffc..82062d73b 100644 --- a/app/components/Search/SearchPage.js +++ b/app/components/Search/SearchPage.js @@ -1,7 +1,7 @@ import { capitalize } from 'lodash' import React from 'react' import { Trans, withNamespaces } from 'react-i18next' -import { connectSearchBox, Index, InfiniteHits } from 'react-instantsearch-dom' +import { Index, InfiniteHits, useSearchBox } from 'react-instantsearch' import { Link } from 'react-router-dom' import styled from 'styled-components' import { Search as SearchIcon } from 'styled-icons/fa-solid' @@ -173,4 +173,14 @@ const SearchPage = ({ t, refine, match, location }) => { ) } +function connectSearchBox(Component) { + const SearchBox = (props) => { + const data = useSearchBox(props) + + return + } + + return SearchBox +} + export default withNamespaces('main')(connectSearchBox(SearchPage))