vue-instantsearch 4.8.7 → 4.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/package.json +3 -3
  2. package/src/components/SearchInput.vue +3 -2
  3. package/src/components/__tests__/InstantSearch.js +32 -0
  4. package/src/components/__tests__/__snapshots__/RefinementList.js.snap +10 -8
  5. package/src/components/__tests__/__snapshots__/SearchBox.js.snap +5 -4
  6. package/src/util/createInstantSearchComponent.js +6 -0
  7. package/vue2/cjs/index.js +1 -1
  8. package/vue2/cjs/index.js.map +1 -1
  9. package/vue2/es/package.json.js +1 -1
  10. package/vue2/es/src/components/SearchInput.vue.js +1 -1
  11. package/vue2/es/src/util/createInstantSearchComponent.js +1 -1
  12. package/vue2/es/src/util/createInstantSearchComponent.js.map +1 -1
  13. package/vue2/umd/index.js +1 -1
  14. package/vue2/umd/index.js.map +1 -1
  15. package/vue3/cjs/index.js +1 -1
  16. package/vue3/cjs/index.js.map +1 -1
  17. package/vue3/es/package.json.js +1 -1
  18. package/vue3/es/src/components/SearchInput.vue.js +1 -1
  19. package/vue3/es/src/components/SearchInput.vue_vue&type=script&lang.js.map +1 -1
  20. package/vue3/es/src/components/SearchInput.vue_vue&type=template&id=00f0f603&lang.js +2 -0
  21. package/vue3/es/src/components/SearchInput.vue_vue&type=template&id=00f0f603&lang.js.map +1 -0
  22. package/vue3/es/src/util/createInstantSearchComponent.js +1 -1
  23. package/vue3/es/src/util/createInstantSearchComponent.js.map +1 -1
  24. package/vue3/umd/index.js +1 -1
  25. package/vue3/umd/index.js.map +1 -1
  26. package/vue3/es/src/components/SearchInput.vue_vue&type=template&id=084af36e&lang.js +0 -2
  27. package/vue3/es/src/components/SearchInput.vue_vue&type=template&id=084af36e&lang.js.map +0 -1
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "autocomplete"
17
17
  ],
18
18
  "license": "MIT",
19
- "version": "4.8.7",
19
+ "version": "4.8.9",
20
20
  "files": [
21
21
  "vue2",
22
22
  "vue3",
@@ -35,7 +35,7 @@
35
35
  "test:exports:vue3": "node ./test/module/vue3/is-es-module.mjs && node ./test/module/vue3/is-cjs-module.cjs"
36
36
  },
37
37
  "dependencies": {
38
- "instantsearch.js": "4.52.0",
38
+ "instantsearch.js": "4.54.0",
39
39
  "mitt": "^2.1.0"
40
40
  },
41
41
  "peerDependencies": {
@@ -85,5 +85,5 @@
85
85
  "vuex": "3.5.1",
86
86
  "vuex4": "npm:vuex@4.0.0"
87
87
  },
88
- "gitHead": "24ab56e4b18d69cc68919f994f8d8a3f1c880d33"
88
+ "gitHead": "419aa9869727dceeb49dfc5289a0b9241e0e5827"
89
89
  }
@@ -38,6 +38,7 @@
38
38
  >
39
39
  <slot name="submit-icon">
40
40
  <svg
41
+ aria-hidden="true"
41
42
  role="img"
42
43
  xmlns="http://www.w3.org/2000/svg"
43
44
  width="10"
@@ -64,10 +65,10 @@
64
65
  >
65
66
  <slot name="reset-icon">
66
67
  <svg
68
+ aria-hidden="true"
67
69
  role="img"
68
70
  xmlns="http://www.w3.org/2000/svg"
69
- width="1em"
70
- height="1em"
71
+ style="width: 1em; height: 1em"
71
72
  viewBox="0 0 20 20"
72
73
  :class="suit('resetIcon')"
73
74
  >
@@ -2,6 +2,7 @@
2
2
  * @jest-environment jsdom
3
3
  */
4
4
 
5
+ import { createAlgoliaSearchClient } from '@instantsearch/mocks';
5
6
  import { isVue3, version as vueVersion } from '../../util/vue-compat';
6
7
  import { mount, nextTick } from '../../../test/utils';
7
8
  import instantsearch from 'instantsearch.js/es';
@@ -177,6 +178,37 @@ it('Allows a change in `search-client`', async () => {
177
178
  expect(helper.search).toHaveBeenCalledTimes(1);
178
179
  });
179
180
 
181
+ it('warns when the `search-client` changes', async () => {
182
+ const wrapper = mount(InstantSearch, {
183
+ propsData: {
184
+ searchClient: createAlgoliaSearchClient({}),
185
+ indexName: 'indexName',
186
+ },
187
+ });
188
+
189
+ const newClient = createAlgoliaSearchClient({});
190
+
191
+ await wrapper.setProps({ searchClient: newClient });
192
+
193
+ expect(warn).toHaveBeenCalledWith(
194
+ false,
195
+ 'The `search-client` prop of `<ais-instant-search>` changed between renders, which may cause more search requests than necessary. If this is an unwanted behavior, please provide a stable reference: https://www.algolia.com/doc/api-reference/widgets/instantsearch/vue/#widget-param-search-client'
196
+ );
197
+ });
198
+
199
+ it('does not warn when the `search-client` does not change', async () => {
200
+ const wrapper = mount(InstantSearch, {
201
+ propsData: {
202
+ searchClient: createAlgoliaSearchClient({}),
203
+ indexName: 'indexName',
204
+ },
205
+ });
206
+
207
+ await wrapper.setProps({ indexName: 'indexName2' });
208
+
209
+ expect(warn).not.toHaveBeenCalled();
210
+ });
211
+
180
212
  it('Allows a change in `search-function`', async () => {
181
213
  const oldValue = () => {};
182
214
  const newValue = () => {};
@@ -23,7 +23,8 @@ exports[`allows search bar classes override when it's searchable 1`] = `
23
23
  title="Search"
24
24
  type="submit"
25
25
  >
26
- <svg class="ais-SearchBox-submitIcon"
26
+ <svg aria-hidden="true"
27
+ class="ais-SearchBox-submitIcon"
27
28
  height="10"
28
29
  role="img"
29
30
  viewbox="0 0 40 40"
@@ -41,11 +42,11 @@ exports[`allows search bar classes override when it's searchable 1`] = `
41
42
  title="Clear"
42
43
  type="reset"
43
44
  >
44
- <svg class="ais-SearchBox-resetIcon"
45
- height="1em"
45
+ <svg aria-hidden="true"
46
+ class="ais-SearchBox-resetIcon"
46
47
  role="img"
48
+ style="width: 1em; height: 1em;"
47
49
  viewbox="0 0 20 20"
48
- width="1em"
49
50
  xmlns="http://www.w3.org/2000/svg"
50
51
  >
51
52
  <path d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
@@ -281,7 +282,8 @@ exports[`renders correctly when it's searchable 1`] = `
281
282
  title="Search"
282
283
  type="submit"
283
284
  >
284
- <svg class="ais-SearchBox-submitIcon"
285
+ <svg aria-hidden="true"
286
+ class="ais-SearchBox-submitIcon"
285
287
  height="10"
286
288
  role="img"
287
289
  viewbox="0 0 40 40"
@@ -299,11 +301,11 @@ exports[`renders correctly when it's searchable 1`] = `
299
301
  title="Clear"
300
302
  type="reset"
301
303
  >
302
- <svg class="ais-SearchBox-resetIcon"
303
- height="1em"
304
+ <svg aria-hidden="true"
305
+ class="ais-SearchBox-resetIcon"
304
306
  role="img"
307
+ style="width: 1em; height: 1em;"
305
308
  viewbox="0 0 20 20"
306
- width="1em"
307
309
  xmlns="http://www.w3.org/2000/svg"
308
310
  >
309
311
  <path d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
@@ -22,7 +22,8 @@ exports[`renders HTML correctly 1`] = `
22
22
  title="Search"
23
23
  type="submit"
24
24
  >
25
- <svg class="ais-SearchBox-submitIcon"
25
+ <svg aria-hidden="true"
26
+ class="ais-SearchBox-submitIcon"
26
27
  height="10"
27
28
  role="img"
28
29
  viewbox="0 0 40 40"
@@ -40,11 +41,11 @@ exports[`renders HTML correctly 1`] = `
40
41
  title="Clear"
41
42
  type="reset"
42
43
  >
43
- <svg class="ais-SearchBox-resetIcon"
44
- height="1em"
44
+ <svg aria-hidden="true"
45
+ class="ais-SearchBox-resetIcon"
45
46
  role="img"
47
+ style="width: 1em; height: 1em;"
46
48
  viewbox="0 0 20 20"
47
- width="1em"
48
49
  xmlns="http://www.w3.org/2000/svg"
49
50
  >
50
51
  <path d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
@@ -2,6 +2,7 @@ import { createSuitMixin } from '../mixins/suit';
2
2
  import { version } from '../../package.json'; // rollup does pick only what needed from json
3
3
  import { _objectSpread } from './polyfills';
4
4
  import { isVue3, version as vueVersion } from './vue-compat';
5
+ import { warn } from './warn';
5
6
 
6
7
  export const createInstantSearchComponent = (component) =>
7
8
  _objectSpread(
@@ -14,6 +15,11 @@ export const createInstantSearchComponent = (component) =>
14
15
  },
15
16
  watch: {
16
17
  searchClient(searchClient) {
18
+ warn(
19
+ false,
20
+ 'The `search-client` prop of `<ais-instant-search>` changed between renders, which may cause more search requests than necessary. If this is an unwanted behavior, please provide a stable reference: https://www.algolia.com/doc/api-reference/widgets/instantsearch/vue/#widget-param-search-client'
21
+ );
22
+
17
23
  this.instantSearchInstance.helper.setClient(searchClient).search();
18
24
  },
19
25
  indexName(indexName) {