Skip to content

Commit 75ccd37

Browse files
committed
refactor(react): replace instantsearch.js with instantsearch-core (#6439)
BREAKING CHANGE: if you are using any internal instantsearch.js functions, ensure to update to instantsearch-core to avoid duplication
1 parent 2087a06 commit 75ccd37

File tree

99 files changed

+200
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+200
-179
lines changed

examples/react/default-theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dependencies": {
1010
"algoliasearch": "5.1.1",
1111
"instantsearch.css": "8.5.1",
12-
"instantsearch.js": "4.75.5",
12+
"instantsearch-core": "0.1.0",
1313
"react": "18.2.0",
1414
"react-dom": "18.2.0",
1515
"react-instantsearch": "7.13.8"

examples/react/default-theme/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { liteClient as algoliasearch } from 'algoliasearch/lite';
2-
import { Hit as AlgoliaHit } from 'instantsearch.js';
2+
import { Hit as AlgoliaHit } from 'instantsearch-core';
33
import React from 'react';
44
import {
55
InstantSearch,

examples/react/e-commerce/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"algoliasearch": "5.1.1",
1313
"instantsearch.css": "8.5.1",
14-
"instantsearch.js": "4.75.5",
14+
"instantsearch-core": "0.1.0",
1515
"react": "18.2.0",
1616
"react-compound-slider": "3.4.0",
1717
"react-dom": "18.2.0",

examples/react/getting-started/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dependencies": {
1010
"algoliasearch": "5.1.1",
1111
"instantsearch.css": "8.5.1",
12-
"instantsearch.js": "4.75.5",
12+
"instantsearch-core": "0.1.0",
1313
"react": "18.2.0",
1414
"react-dom": "18.2.0",
1515
"react-instantsearch": "7.13.8"

examples/react/getting-started/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { liteClient as algoliasearch } from 'algoliasearch/lite';
2-
import { Hit } from 'instantsearch.js';
2+
import { Hit } from 'instantsearch-core';
33
import React from 'react';
44
import {
55
Configure,

examples/react/getting-started/src/Product.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { liteClient as algoliasearch } from 'algoliasearch/lite';
2-
import { type Hit } from 'instantsearch.js';
32
import React from 'react';
43
import {
54
Configure,
@@ -9,6 +8,8 @@ import {
98
Carousel,
109
} from 'react-instantsearch';
1110

11+
import type { Hit } from 'instantsearch-core';
12+
1213
import './App.css';
1314
import 'instantsearch.css/themes/satellite.css';
1415

examples/react/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"algoliasearch": "5.1.1",
1515
"expo": "~44.0.0",
1616
"expo-status-bar": "~1.2.0",
17-
"instantsearch.js": "4.75.5",
17+
"instantsearch-core": "0.1.0",
1818
"react": "17.0.1",
1919
"react-instantsearch-core": "7.13.8",
2020
"react-native": "0.64.3",

examples/react/react-native/src/Highlight.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import React, { Fragment } from 'react';
22
import { StyleSheet, Text } from 'react-native';
3-
import { Hit as AlgoliaHit } from 'instantsearch.js';
4-
import {
5-
getHighlightedParts,
6-
getPropertyByPath,
7-
} from 'instantsearch.js/es/lib/utils';
3+
import { getHighlightedParts, getPropertyByPath } from 'instantsearch-core';
4+
5+
import type { Hit as AlgoliaHit } from 'instantsearch-core';
86

97
type HighlightPartProps = {
108
children: React.ReactNode;

examples/react/react-native/src/InfiniteHits.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React, { forwardRef } from 'react';
22
import { StyleSheet, View, FlatList } from 'react-native';
3-
import { Hit as AlgoliaHit } from 'instantsearch.js';
43
import {
54
useInfiniteHits,
65
UseInfiniteHitsProps,
76
} from 'react-instantsearch-core';
87

8+
import type { Hit as AlgoliaHit } from 'instantsearch-core';
9+
910
type InfiniteHitsProps<THit> = UseInfiniteHitsProps & {
1011
hitComponent: (props: { hit: THit }) => JSX.Element;
1112
};

examples/react/ssr/src/App.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { history } from 'instantsearch.js/cjs/lib/routers';
2-
import { simple } from 'instantsearch.js/cjs/lib/stateMappings';
1+
import {
2+
historyRouter as history,
3+
simpleStateMapping as simple,
4+
} from 'instantsearch-core';
35
import React from 'react';
46
import {
57
Configure,
@@ -12,11 +14,6 @@ import {
1214
RefinementList,
1315
SearchBox,
1416
} from 'react-instantsearch';
15-
// because this is ran on node without type: "module" set in the package.json
16-
// we need to use commonjs instead of esm.
17-
// If you use ESM in Node, you can rely on these import statements instead:
18-
// import { simple } from 'instantsearch.js/es/lib/stateMappings';
19-
// import { history } from 'instantsearch.js/es/lib/routers';
2017

2118
import { searchClient } from './searchClient';
2219

0 commit comments

Comments
 (0)