Skip to content

Commit 7eb6810

Browse files
francoischalifourHaroenv
authored andcommitted
fix(warnings): remove v3 warnings (#4134)
1 parent 437a4c4 commit 7eb6810

File tree

6 files changed

+0
-137
lines changed

6 files changed

+0
-137
lines changed

src/connectors/geo-search/connectGeoSearch.js

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
checkRendering,
3-
warning,
43
aroundLatLngToPosition,
54
insideBoundingBoxToBoundingBox,
65
createDocumentationMessageGenerator,
@@ -111,81 +110,6 @@ const connectGeoSearch = (renderFn, unmountFn = noop) => {
111110
transformItems = items => items,
112111
} = widgetParams;
113112

114-
// Always trigger this message because the default value was `true`. We can't
115-
// display the message only when the parameter is defined otherwise a user that was
116-
// relying on the default value won't have any information about the changes.
117-
warning(
118-
false,
119-
`
120-
The option \`enableGeolocationWithIP\` has been removed from the GeoSearch widget.
121-
Please consider using the \`Configure\` widget instead:
122-
123-
search.addWidget(
124-
configure({
125-
aroundLatLngViaIP: ${widgetParams.enableGeolocationWithIP || 'true'},
126-
})
127-
);
128-
129-
You can find more information inside the migration guide:
130-
http://community.algolia.com/instantsearch.js/migration-guide
131-
`
132-
);
133-
134-
warning(
135-
typeof widgetParams.position === 'undefined',
136-
`
137-
The option \`position\` has been removed from the GeoSearch widget.
138-
Please consider using the \`Configure\` widget instead:
139-
140-
search.addWidget(
141-
configure({
142-
aroundLatLng: '${widgetParams.position &&
143-
widgetParams.position.lat}, ${widgetParams.position &&
144-
widgetParams.position.lng}',
145-
})
146-
);
147-
148-
You can find more information inside the migration guide:
149-
http://community.algolia.com/instantsearch.js/migration-guide
150-
`
151-
);
152-
153-
warning(
154-
typeof widgetParams.radius === 'undefined',
155-
`
156-
The option \`radius\` has been removed from the GeoSearch widget.
157-
Please consider using the \`Configure\` widget instead:
158-
159-
search.addWidget(
160-
configure({
161-
aroundRadius: ${widgetParams.radius},
162-
})
163-
);
164-
165-
You can find more information inside the migration guide:
166-
167-
http://community.algolia.com/instantsearch.js/migration-guide
168-
`
169-
);
170-
171-
warning(
172-
typeof widgetParams.precision === 'undefined',
173-
`
174-
The option \`precision\` has been removed from the GeoSearch widget.
175-
Please consider using the \`Configure\` widget instead:
176-
177-
search.addWidget(
178-
configure({
179-
aroundPrecision: ${widgetParams.precision},
180-
})
181-
);
182-
183-
You can find more information inside the migration guide:
184-
185-
http://community.algolia.com/instantsearch.js/migration-guide
186-
`
187-
);
188-
189113
const widgetState = {
190114
isRefineOnMapMove: enableRefineOnMapMove,
191115
hasMapMoveSinceLastRefine: false,

src/widgets/hits/__tests__/hits-test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ describe('hits()', () => {
7070
expect(render.mock.calls[0][0]).toMatchSnapshot();
7171
});
7272

73-
it('does not accept both item and allItems templates', () => {
74-
expect(
75-
hits.bind({ container, templates: { item: '', allItems: '' } })
76-
).toThrow();
77-
});
78-
7973
it('should add __position key with absolute position', () => {
8074
results = { ...results, page: 4, hitsPerPage: 10 };
8175
const state = { page: results.page };

src/widgets/hits/hits.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import defaultTemplates from './defaultTemplates';
66
import {
77
prepareTemplateProps,
88
getContainerNode,
9-
warning,
10-
createDocumentationLink,
119
createDocumentationMessageGenerator,
1210
} from '../../lib/utils';
1311
import { component } from '../../lib/suit';
@@ -99,16 +97,6 @@ export default function hits({
9997
throw new Error(withUsage('The `container` option is required.'));
10098
}
10199

102-
warning(
103-
typeof templates.allItems === 'undefined',
104-
`The template \`allItems\` does not exist since InstantSearch.js 3.
105-
106-
You may want to migrate using \`connectHits\`: ${createDocumentationLink({
107-
name: 'hits',
108-
connector: true,
109-
})}.`
110-
);
111-
112100
const containerNode = getContainerNode(container);
113101
const cssClasses = {
114102
root: cx(suit(), userCssClasses.root),

src/widgets/infinite-hits/infinite-hits.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import connectInfiniteHits, {
88
import {
99
prepareTemplateProps,
1010
getContainerNode,
11-
warning,
12-
createDocumentationLink,
1311
createDocumentationMessageGenerator,
1412
} from '../../lib/utils';
1513
import { component } from '../../lib/suit';
@@ -178,17 +176,6 @@ const infiniteHits: InfiniteHits = (
178176
throw new Error(withUsage('The `container` option is required.'));
179177
}
180178

181-
warning(
182-
// @ts-ignore: We have this specific check because unlike `hits`, `infiniteHits` does not support
183-
// the `allItems` template. This can be misleading as they are very similar.
184-
typeof templates.allItems === 'undefined',
185-
`The template \`allItems\` does not exist since InstantSearch.js 3.
186-
187-
You may want to migrate using \`connectInfiniteHits\`: ${createDocumentationLink(
188-
{ name: 'infinite-hits', connector: true }
189-
)}.`
190-
);
191-
192179
const containerNode = getContainerNode(container);
193180
const cssClasses = {
194181
root: cx(suit(), userCssClasses.root),

src/widgets/search-box/__tests__/search-box-test.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ describe('searchBox()', () => {
3434
"The \`container\` option is required.
3535
3636
See documentation: https://www.algolia.com/doc/api-reference/widgets/search-box/js/"
37-
`);
38-
});
39-
40-
it('throws with an `input` container', () => {
41-
expect(() => {
42-
searchBox({
43-
container: document.createElement('input'),
44-
});
45-
}).toThrowErrorMatchingInlineSnapshot(`
46-
"The \`container\` option doesn't accept \`input\` elements since InstantSearch.js 3.
47-
48-
You may want to migrate using \`connectSearchBox\`: https://www.algolia.com/doc/api-reference/widgets/searchbox/js/#connector."
4937
`);
5038
});
5139
});

src/widgets/search-box/search-box.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, { render, unmountComponentAtNode } from 'preact-compat';
22
import cx from 'classnames';
33
import {
44
getContainerNode,
5-
warning,
6-
createDocumentationLink,
75
createDocumentationMessageGenerator,
86
} from '../../lib/utils';
97
import { component } from '../../lib/suit';
@@ -119,22 +117,6 @@ export default function searchBox({
119117

120118
const containerNode = getContainerNode(container);
121119

122-
if (containerNode.tagName === 'INPUT') {
123-
throw new Error(
124-
`The \`container\` option doesn't accept \`input\` elements since InstantSearch.js 3.
125-
126-
You may want to migrate using \`connectSearchBox\`: ${createDocumentationLink({
127-
name: 'searchbox',
128-
connector: true,
129-
})}.`
130-
);
131-
}
132-
133-
warning(
134-
typeof autofocus === 'boolean',
135-
'The `autofocus` option only supports boolean values since InstantSearch.js 3.'
136-
);
137-
138120
const cssClasses = {
139121
root: cx(suit(), userCssClasses.root),
140122
form: cx(suit({ descendantName: 'form' }), userCssClasses.form),

0 commit comments

Comments
 (0)