Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 84c99fe

Browse files
feat(hooks): remove experimental warning (#3446)
* feat(hooks): remove experimental warning * Remove unused import
1 parent 47293bd commit 84c99fe

File tree

2 files changed

+3
-55
lines changed

2 files changed

+3
-55
lines changed

packages/react-instantsearch-hooks/src/components/__tests__/InstantSearch.test.tsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -182,34 +182,4 @@ describe('InstantSearch', () => {
182182
expect(searchClient.search).toHaveBeenCalledTimes(1);
183183
});
184184
});
185-
186-
describe('experimental warning', () => {
187-
test('displays an experimental warning', () => {
188-
const searchClient = createSearchClient({});
189-
190-
expect(() => {
191-
render(
192-
<InstantSearch indexName="indexName" searchClient={searchClient} />
193-
);
194-
}).toWarnDev(
195-
'[InstantSearch] This version is experimental and not production-ready.\n\n' +
196-
'Please report any bugs at https://github.com/algolia/react-instantsearch/issues/new?template=Bug_report_Hooks.md&labels=Scope%3A%20Hooks\n\n' +
197-
'(To disable this warning, pass `suppressExperimentalWarning` to <InstantSearch>.)'
198-
);
199-
});
200-
201-
test('hides the experimental warning with suppressExperimentalWarning', () => {
202-
const searchClient = createSearchClient({});
203-
204-
expect(() => {
205-
render(
206-
<InstantSearch
207-
indexName="indexName"
208-
searchClient={searchClient}
209-
suppressExperimentalWarning={true}
210-
/>
211-
);
212-
}).not.toWarnDev();
213-
});
214-
});
215185
});

packages/react-instantsearch-hooks/src/lib/useInstantSearch.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import version from '../version';
77

88
import { useForceUpdate } from './useForceUpdate';
99
import { useStableValue } from './useStableValue';
10-
import { warn } from './warn';
1110

1211
import type { InstantSearchServerContextApi } from '../components/InstantSearchServerContext';
1312
import type { InstantSearchServerState } from '../components/InstantSearchSSRProvider';
@@ -19,21 +18,9 @@ const defaultUserAgents = [
1918
`react-instantsearch-hooks (${version})`,
2019
];
2120

22-
export type UseInstantSearchProps = InstantSearchOptions & {
23-
/**
24-
* Removes the console warning about the experimental version.
25-
*
26-
* Note that this warning is only displayed in development mode.
27-
*
28-
* @default false
29-
*/
30-
suppressExperimentalWarning?: boolean;
31-
};
32-
33-
export function useInstantSearch({
34-
suppressExperimentalWarning = false,
35-
...props
36-
}: UseInstantSearchProps) {
21+
export type UseInstantSearchProps = InstantSearchOptions;
22+
23+
export function useInstantSearch(props: UseInstantSearchProps) {
3724
const serverContext = useInstantSearchServerContext();
3825
const serverState = useInstantSearchSSRContext();
3926
const stableProps = useStableValue(props);
@@ -49,15 +36,6 @@ export function useInstantSearch({
4936
);
5037
const forceUpdate = useForceUpdate();
5138

52-
useEffect(() => {
53-
warn(
54-
suppressExperimentalWarning,
55-
'This version is experimental and not production-ready.\n\n' +
56-
'Please report any bugs at https://github.com/algolia/react-instantsearch/issues/new?template=Bug_report_Hooks.md&labels=Scope%3A%20Hooks\n\n' +
57-
'(To disable this warning, pass `suppressExperimentalWarning` to <InstantSearch>.)'
58-
);
59-
}, [suppressExperimentalWarning]);
60-
6139
useEffect(() => {
6240
addAlgoliaAgents(stableProps.searchClient, defaultUserAgents);
6341
}, [stableProps.searchClient]);

0 commit comments

Comments
 (0)