Skip to content

feat(dependencies): react-instantsearch-hooks -> react-instantsearch #664

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

Open
wants to merge 2 commits into
base: main
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Before proceeding, please make sure you have the following:

### How to run the apps

To init and install dependancies please use :
To init and install dependencies please use :

pnpm install

Expand Down Expand Up @@ -62,4 +62,5 @@ The Boilerplate is highly scalable, and customizable. It is made with ReactInsta
By following the steps described in this documentation you will be able to build your own Algolia application in matter of minutes.

Happy Coding!

# boilerplate-demo-with-neural
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sidebar_position: 2
- called by Index.jsx
- calls Main.jsx
- Wraps child components in Algolia Instantsearch
- [Algolia instantsearch](https://github.com/algolia/react-instantsearch)
- [Algolia React InstantSearch](https://github.com/algolia/instantsearch)

### Main.jsx

Expand Down
10 changes: 5 additions & 5 deletions apps/boilerplate-front-end/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ App.jsx
- called by Index.jsx
- calls Main.jsx
- Wraps child components in Algolia Instantsearch
- [Algolia instantsearch](https://github.com/algolia/react-instantsearch)
- [Algolia React InstantSearch](https://github.com/algolia/instantsearch)

Main.jsx

Expand Down Expand Up @@ -848,7 +848,7 @@ Scan through our [existing issues](https://github.com/algolia/algolia-react-boil
- Using the command line:
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.

2. Install or update all the needed dependancies. You can do so by following our [Getting started Section](#️-get-started)
2. Install or update all the needed dependencies. You can do so by following our [Getting started Section](#️-get-started)

3. Create a working branch and start with your changes!

Expand Down Expand Up @@ -895,19 +895,19 @@ nvm use 14

### pnpm version

Your pnpm version should higher than 8.0.0 to avoid any dependancy issue with InstantSearch Hooks package.
Your pnpm version should higher than 8.0.0 to avoid any dependency issue with InstantSearch Hooks package.

If you still get any issue using pnpm you can try using `yarn` or `npm`. You might also want to try with `npm install --force`

### package issue

If you encounter an issue with the package react-instantsearch-hooks-web please try to install the dependancies with npm or yarn as mentionned above.
If you encounter an issue with the package react-instantsearch please try to install the dependencies with npm or yarn as mentioned above.

If you encounter an issue with turbo-darwin-64 please install the package in the front-end folder with your package manager of choice.

### Sass - Scss compiler

If you are unable to install sass library or you simply don't want to use it whithin the app, we are providing in each folder in a `compiled CSS` subfolder the compiled and the minified CSS of our Scss files.
If you are unable to install sass library or you simply don't want to use it within the app, we are providing in each folder in a `compiled CSS` subfolder the compiled and the minified CSS of our Scss files.

Feel free to use it.

Expand Down
4 changes: 2 additions & 2 deletions apps/boilerplate-front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"algoliasearch": "4.14.2",
"framer-motion": "^7.0.0",
"i18next": "^21.8.11",
"instantsearch.js": "^4.49.2",
"instantsearch.js": "^4.60.0",
"lodash": "^4.17.21",
"lodash.debounce": "^4.0.8",
"npm": "^8.5.5",
Expand All @@ -57,7 +57,7 @@
"react-dom": "^18.2.0",
"react-i18next": "^11.17.4",
"react-icons": "^4.8.0",
"react-instantsearch-hooks-web": "^6.42.2",
"react-instantsearch": "^7.3.0",
"react-router-dom": "6.3.0",
"recoil": "^0.7.4",
"sass": "^1.49.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/boilerplate-front-end/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { mainIndex } from '@/config/algoliaEnvConfig'
import { searchClient } from './config/algoliaEnvConfig'

// Algolia Instantsearch components
import { InstantSearch } from 'react-instantsearch-hooks-web'
import { InstantSearch } from 'react-instantsearch'

// Import Components
import Main from './Main'
Expand Down
2 changes: 1 addition & 1 deletion apps/boilerplate-front-end/src/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Configure,
useInstantSearch,
useSearchBox,
} from 'react-instantsearch-hooks-web'
} from 'react-instantsearch'

// Algolia Insights
import { InsightsMiddleware } from './config/algoliaInsightEvents'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'

import { useInstantSearch } from 'react-instantsearch-hooks-web'
import { useInstantSearch } from 'react-instantsearch'

import { useRecoilState, useRecoilValue } from 'recoil'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The queryRuleCustomData widget displays custom data from Rules.
// You use this widget to display banners or recommendations returned by Rules, and that match search parameters.

import { useQueryRules } from 'react-instantsearch-hooks-web'
import { useQueryRules } from 'react-instantsearch'

//SCSS import
import './SCSS/banner.scss'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useEffect, useState } from 'react'
import { useRecoilValue } from 'recoil'

// This component will be wrapped in connectQueryRules (https://www.algolia.com/doc/api-reference/widgets/query-rule-custom-data/react/#connector)
import { useQueryRules } from 'react-instantsearch-hooks-web'
import { useQueryRules } from 'react-instantsearch'

// Imports from router
import { Link } from 'react-router-dom'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from 'react'

import { motion } from 'framer-motion'
import { Configure, Index, useHits } from 'react-instantsearch-hooks-web'
import { Configure, Index, useHits } from 'react-instantsearch'

// Recoil
import { useRecoilValue, useSetRecoilState } from 'recoil'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from 'react'
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'

// Algolia imports
import { useHits } from 'react-instantsearch-hooks-web'
import { useHits } from 'react-instantsearch'

//Use Translation
import { useTranslation } from 'react-i18next'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DynamicWidgets,
useRefinementList,
useInstantSearch,
} from 'react-instantsearch-hooks-web'
} from 'react-instantsearch'

// Import magnifying glass svg, and price slider component
import { ChevronDown, ChevronUp, Glass } from '@/assets/svg/SvgIndex'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { navigationStateAtom } from '@/config/navigationConfig'
import { useEffect } from 'react'
import { useClearRefinements } from 'react-instantsearch-hooks-web'
import { useClearRefinements } from 'react-instantsearch'
import { useSearchParams } from 'react-router-dom'
import { useRecoilState } from 'recoil'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Component that renders the Current Refinements (icons above the products)
import { useCurrentRefinements } from 'react-instantsearch-hooks-web'
import { useCurrentRefinements } from 'react-instantsearch'
// Recoil State
import { useRecoilState } from 'recoil'
// import config file for state of facets
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Renders the Hierarchical facets
import { useHierarchicalMenu } from 'react-instantsearch-hooks-web'
import { useHierarchicalMenu } from 'react-instantsearch'

//Use Translation
import { useTranslation } from 'react-i18next'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useRecoilState } from 'recoil'
import Slider from 'rc-slider'
import 'rc-slider/assets/index.css'
// Import the range function from IS hook
import { useRange } from 'react-instantsearch-hooks-web'
import { useRange } from 'react-instantsearch'
// import Currency from recoil
import { currencySymbolAtom } from '@/config/currencyConfig'
import { showNetworkErorrs } from '@/config/demoGuideConfig'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { memo, useEffect, useState } from 'react'

// Algolias's import
import { Configure, Index } from 'react-instantsearch-hooks-web'
import { Configure, Index } from 'react-instantsearch'

// framer motion
import { motion } from 'framer-motion'
Expand Down Expand Up @@ -60,7 +60,7 @@ import RecentSearches from './components/RecentSearches'
//Import scope SCSS
import './SCSS/federatedSearch.scss'

import { useSearchBox } from 'react-instantsearch-hooks-web'
import { useSearchBox } from 'react-instantsearch'
import QueryCat from './components/QueryCat'

const FederatedSearch = ({ query, refine, results }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { memo } from 'react'

// Algolia
import { useHits } from 'react-instantsearch-hooks-web'
import { useHits } from 'react-instantsearch'

import { useRecoilValue } from 'recoil'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { memo } from 'react'
import { useNavigate } from 'react-router-dom'

// Algolia's imports
import { useRefinementList } from 'react-instantsearch-hooks-web'
import { useRefinementList } from 'react-instantsearch'

// component import
import { ChevronRight } from '@/assets/svg/SvgIndex'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { memo } from 'react'

// Algolia's imports
import { Highlight, useHits } from 'react-instantsearch-hooks-web'
import { Highlight, useHits } from 'react-instantsearch'

// Component import
import { ChevronRight } from '@/assets/svg/SvgIndex'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { memo, useMemo } from 'react'
import { debounce } from 'lodash'

// Algolia's imports
import { Highlight, useHits } from 'react-instantsearch-hooks-web'
import { Highlight, useHits } from 'react-instantsearch'

// components import
import { ChevronRight } from '@/assets/svg/SvgIndex'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
} from '@/config/featuresConfig'
import useOutsideClick from '@/hooks/useOutsideClick'
import usePreventScrolling from '@/hooks/usePreventScrolling'
import { useSearchBox } from 'react-instantsearch-hooks-web'
import { useSearchBox } from 'react-instantsearch'

const HeaderMobile = ({ mobile, tablet }) => {
const { query, refine } = useSearchBox()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
useHierarchicalMenu,
useRefinementList,
useSearchBox,
} from 'react-instantsearch-hooks-web'
} from 'react-instantsearch'
import { localSearchQueryAtom } from '@/config/searchboxConfig'
import ConditionalWrapper from '@/utils/ConditionalWrapper'

Expand Down
2 changes: 1 addition & 1 deletion apps/boilerplate-front-end/src/components/hits/Hit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react'
// Import framer-motion for animation on hits
import { AnimatePresence, motion } from 'framer-motion'

import { Highlight } from 'react-instantsearch-hooks-web'
import { Highlight } from 'react-instantsearch'
// Import SVGs
import { CartPicto, Heart, InfoPicto } from '@/assets/svg/SvgIndex'
import RankingIcon from './components/RankingIcon'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useInstantSearch,
useQueryRules,
useSearchBox,
} from 'react-instantsearch-hooks-web'
} from 'react-instantsearch'

// Components
import CustomSkeleton from '@/components/skeletons/CustomSkeleton'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// The queryRuleCustomData widget displays custom data from Rules.
// You use this widget to display banners or recommendations returned by Rules, and that match search parameters.
// You can find the expected rule response by looking at Landing Pages in the Readme
import { useQueryRules } from 'react-instantsearch-hooks-web'
import { useQueryRules } from 'react-instantsearch'

// SCSS import
import './SCSS/landing-page-header.scss'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import IS hook
import { Configure, Index, useSearchBox } from 'react-instantsearch-hooks-web'
import { Configure, Index, useSearchBox } from 'react-instantsearch'

// Import recoil function
import { useRecoilValue } from 'recoil'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { hitsConfig } from '@/config/hitsConfig'

// Import highlight widget from InstantSearch library
import { Highlight } from 'react-instantsearch-hooks-web'
import { Highlight } from 'react-instantsearch'

// Import heart svg
import { CartPicto, Heart, PlusPicto } from '@/assets/svg/SvgIndex'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { hitsConfig } from '@/config/hitsConfig'

// Import highlight widget from InstantSearch library
import { Highlight } from 'react-instantsearch-hooks-web'
import { Highlight } from 'react-instantsearch'

// Import heart svg
import { CartPicto, Heart } from '@/assets/svg/SvgIndex'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'

import { useTrendingFacets } from '@algolia/recommend-react'
import { useRefinementList } from 'react-instantsearch-hooks-web'
import { useRefinementList } from 'react-instantsearch'

import { useRecoilState, useRecoilValue } from 'recoil'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { memo, useEffect, useState } from 'react'

//Algolia's import
import { useQueryRules } from 'react-instantsearch-hooks-web'
import { useQueryRules } from 'react-instantsearch'

// Import Recoil
import { useRecoilState } from 'recoil'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import useStoreQueryToLocalStorage from '@/hooks/useStoreStringToLocalStorage'
//Import scope SCSS
import './SCSS/searchbox.scss'

import { useSearchBox } from 'react-instantsearch-hooks-web'
import { useSearchBox } from 'react-instantsearch'

import { useSearchParams } from 'react-router-dom'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useRecoilState } from 'recoil'
import {
useHierarchicalMenu,
useRefinementList,
} from 'react-instantsearch-hooks-web'
} from 'react-instantsearch'

// React router
import { useSearchParams } from 'react-router-dom'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This is for displaying the SortBy widget, eg Price asc/desc
import { useSortBy } from 'react-instantsearch-hooks-web'
import { useSortBy } from 'react-instantsearch'
import './sortby.scss'

function CustomSortBy(props) {
Expand Down
2 changes: 1 addition & 1 deletion apps/boilerplate-front-end/src/components/stats/Stats.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is for building the stats info that is displayed above the items in the search results page
import connectStats from 'instantsearch.js/es/connectors/stats/connectStats'
import { useConnector } from 'react-instantsearch-hooks-web'
import { useConnector } from 'react-instantsearch'

//Use Translation
import { useTranslation } from 'react-i18next'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createSearchParams, useLocation, useNavigate } from 'react-router-dom'
import { useSetRecoilState } from 'recoil'

import connectVoiceSearch from 'instantsearch.js/es/connectors/voice-search/connectVoiceSearch'
import { useConnector, useSearchBox } from 'react-instantsearch-hooks-web'
import { useConnector, useSearchBox } from 'react-instantsearch'

// Import searchbox Config
import { searchBoxIsActive } from '@/config/searchboxConfig'
Expand Down
8 changes: 4 additions & 4 deletions apps/boilerplate-front-end/src/config/algoliaInsightEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { personaObjectSelectedAtom } from './personaConfig'
import aa from 'search-insights'
import { createInsightsMiddleware } from 'instantsearch.js/es/middlewares'
import { useLayoutEffect } from 'react'
import { useInstantSearch } from 'react-instantsearch-hooks-web'
import { useInstantSearch } from 'react-instantsearch'

export function InsightsMiddleware() {
const { use } = useInstantSearch()
const { addMiddlewares } = useInstantSearch()
const persona = useRecoilValue(personaObjectSelectedAtom)

useLayoutEffect(() => {
Expand All @@ -22,8 +22,8 @@ export function InsightsMiddleware() {
// and attaches the `userToken` to search calls onwards.
aa('setUserToken', userToken)

return use(middleware)
}, [use])
return addMiddlewares(middleware)
}, [addMiddlewares])

return null
}
Loading