Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps(Algolia): upgrade React InstantSearch #1159

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion app/components/Search/IndexSearchEntriesCount.js
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/components/Search/SearchBox.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
12 changes: 11 additions & 1 deletion app/components/Search/SearchPage.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -173,4 +173,14 @@ const SearchPage = ({ t, refine, match, location }) => {
)
}

function connectSearchBox(Component) {
const SearchBox = (props) => {
const data = useSearchBox(props)

return <Component {...props} {...data} />
}

return SearchBox
}

export default withNamespaces('main')(connectSearchBox(SearchPage))
Loading
Loading