react-instantsearch-core 7.0.1 → 7.0.3

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
2
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
- **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
3
+
4
4
 
5
5
  - [react-instantsearch-core](#react-instantsearch-core)
6
6
  - [Installation](#installation)
@@ -19,7 +19,7 @@ React InstantSearch Core is an open-source UI library for React that lets you qu
19
19
  InstantSearch’s goal is to help you implement awesome search experiences as smoothly as possible by providing a [complete search ecosystem](https://algolia.com/doc/guides/getting-started/how-algolia-works/#the-full-ecosystem). InstantSearch tackles an important part of this vast goal by providing front-end primitives that you can assemble into unique search interfaces.
20
20
 
21
21
  <p align="center">
22
- <a href="https://codesandbox.io/s/github/algolia/instantsearch.js/tree/master/examples/react/default-themes" title="Edit on CodeSandbox">
22
+ <a href="https://codesandbox.io/s/github/algolia/instantsearch/tree/master/examples/react/default-themes" title="Edit on CodeSandbox">
23
23
  <img alt="Edit on CodeSandbox" src="https://codesandbox.io/static/img/play-codesandbox.svg">
24
24
  </a>
25
25
  </p>
@@ -65,7 +65,7 @@ To start contributing to code, you need to:
65
65
  1. [Clone the repository](https://help.github.com/articles/cloning-a-repository/)
66
66
  1. Install the dependencies: `yarn`
67
67
 
68
- Please read [our contribution process](https://github.com/algolia/instantsearch.js/blob/master/CONTRIBUTING.md) to learn more.
68
+ Please read [our contribution process](https://github.com/algolia/instantsearch/blob/master/CONTRIBUTING.md) to learn more.
69
69
 
70
70
  ## License
71
71
 
@@ -73,9 +73,9 @@ React InstantSearch is [MIT licensed](../../LICENSE).
73
73
 
74
74
  <!-- Links -->
75
75
 
76
- [contributing-bugreport]: https://github.com/algolia/instantsearch.js/issues/new?template=BUG_REPORT.yml&labels=triage,Library%3A%20React+InstantSearch
77
- [contributing-featurerequest]: https://github.com/algolia/instantsearch.js/discussions/new?category=ideas&labels=triage,Library%3A%20React+InstantSearch&title=Feature%20request%3A%20
78
- [contributing-newissue]: https://github.com/algolia/instantsearch.js/issues/new?labels=triage,Library%3A%20React+InstantSearch
79
- [contributing-label-easy]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22Difficulty%3A+Easy%22+label%3A%22Library%3A%20React+InstantSearch%22
80
- [contributing-label-bug]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Bug%22+label%3A%22Library%3A%20React+InstantSearch%22
81
- [contributing-label-chore]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Chore%22+label%3A%22Library%3A%20React+InstantSearch%22
76
+ [contributing-bugreport]: https://github.com/algolia/instantsearch/issues/new?template=BUG_REPORT.yml&labels=triage,Library%3A%20React+InstantSearch
77
+ [contributing-featurerequest]: https://github.com/algolia/instantsearch/discussions/new?category=ideas&labels=triage,Library%3A%20React+InstantSearch&title=Feature%20request%3A%20
78
+ [contributing-newissue]: https://github.com/algolia/instantsearch/issues/new?labels=triage,Library%3A%20React+InstantSearch
79
+ [contributing-label-easy]: https://github.com/algolia/instantsearch/issues?q=is%3Aopen+is%3Aissue+label%3A%22Difficulty%3A+Easy%22+label%3A%22Library%3A%20React+InstantSearch%22
80
+ [contributing-label-bug]: https://github.com/algolia/instantsearch/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Bug%22+label%3A%22Library%3A%20React+InstantSearch%22
81
+ [contributing-label-chore]: https://github.com/algolia/instantsearch/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Chore%22+label%3A%22Library%3A%20React+InstantSearch%22
@@ -100,7 +100,7 @@ function useConnector(connector) {
100
100
 
101
101
  // We get the widget render state by providing the same parameters as
102
102
  // InstantSearch provides to the widget's `render` method.
103
- // See https://github.com/algolia/instantsearch.js/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
103
+ // See https://github.com/algolia/instantsearch/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
104
104
  var _widget$getWidgetRend = widget.getWidgetRenderState({
105
105
  helper: helper,
106
106
  parent: parentIndex,
@@ -34,7 +34,7 @@ function useInstantSearchApi(props) {
34
34
  if (searchRef.current === null) {
35
35
  // We don't use the `instantsearch()` function because it comes with other
36
36
  // top-level APIs that we don't need.
37
- // See https://github.com/algolia/instantsearch.js/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
37
+ // See https://github.com/algolia/instantsearch/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
38
38
  var search = new _InstantSearch.default(props);
39
39
  search._schedule = function _schedule(cb) {
40
40
  search._schedule.queue.push(cb);
@@ -29,7 +29,7 @@ function useSearchResults() {
29
29
 
30
30
  // Results can be `null` when the first search is stalled.
31
31
  // In this case, we skip the update.
32
- // See: https://github.com/algolia/instantsearch.js/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
32
+ // See: https://github.com/algolia/instantsearch/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
33
33
  if (results !== null) {
34
34
  setSearchResults({
35
35
  results: results,
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '7.0.1';
7
+ var _default = '7.0.3';
8
8
  exports.default = _default;
@@ -94,7 +94,7 @@ export function useConnector(connector) {
94
94
 
95
95
  // We get the widget render state by providing the same parameters as
96
96
  // InstantSearch provides to the widget's `render` method.
97
- // See https://github.com/algolia/instantsearch.js/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
97
+ // See https://github.com/algolia/instantsearch/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
98
98
  var _widget$getWidgetRend = widget.getWidgetRenderState({
99
99
  helper: helper,
100
100
  parent: parentIndex,
@@ -27,7 +27,7 @@ export function useInstantSearchApi(props) {
27
27
  if (searchRef.current === null) {
28
28
  // We don't use the `instantsearch()` function because it comes with other
29
29
  // top-level APIs that we don't need.
30
- // See https://github.com/algolia/instantsearch.js/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
30
+ // See https://github.com/algolia/instantsearch/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
31
31
  var search = new InstantSearch(props);
32
32
  search._schedule = function _schedule(cb) {
33
33
  search._schedule.queue.push(cb);
@@ -23,7 +23,7 @@ export function useSearchResults() {
23
23
 
24
24
  // Results can be `null` when the first search is stalled.
25
25
  // In this case, we skip the update.
26
- // See: https://github.com/algolia/instantsearch.js/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
26
+ // See: https://github.com/algolia/instantsearch/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
27
27
  if (results !== null) {
28
28
  setSearchResults({
29
29
  results: results,
@@ -1,2 +1,2 @@
1
- declare const _default: "7.0.1";
1
+ declare const _default: "7.0.3";
2
2
  export default _default;
@@ -1 +1 @@
1
- export default '7.0.1';
1
+ export default '7.0.3';
@@ -1,4 +1,4 @@
1
- /*! React InstantSearchCore UNRELEASED | © Algolia, inc. | https://github.com/algolia/instantsearch.js */
1
+ /*! React InstantSearchCore UNRELEASED | © Algolia, inc. | https://github.com/algolia/instantsearch */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
@@ -7,7 +7,7 @@
7
7
 
8
8
  var React__default = 'default' in React ? React['default'] : React;
9
9
 
10
- var version = '7.0.1';
10
+ var version = '7.0.3';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -4327,7 +4327,7 @@
4327
4327
 
4328
4328
  var SearchResults_1 = SearchResults;
4329
4329
 
4330
- var version$1 = '3.14.0';
4330
+ var version$1 = '3.14.1';
4331
4331
 
4332
4332
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4333
4333
 
@@ -8195,7 +8195,7 @@
8195
8195
 
8196
8196
  // We get the widget render state by providing the same parameters as
8197
8197
  // InstantSearch provides to the widget's `render` method.
8198
- // See https://github.com/algolia/instantsearch.js/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
8198
+ // See https://github.com/algolia/instantsearch/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
8199
8199
  var _widget$getWidgetRend = widget.getWidgetRenderState({
8200
8200
  helper: helper,
8201
8201
  parent: parentIndex,
@@ -8948,7 +8948,7 @@
8948
8948
  // configuration step. This is mainly for backward compatibility with custom
8949
8949
  // widgets. When the subscription happens before the `init` step, the (static)
8950
8950
  // configuration of the widget is pushed in the URL. That's what we want to avoid.
8951
- // https://github.com/algolia/instantsearch.js/pull/994/commits/4a672ae3fd78809e213de0368549ef12e9dc9454
8951
+ // https://github.com/algolia/instantsearch/pull/994/commits/4a672ae3fd78809e213de0368549ef12e9dc9454
8952
8952
  helper.on('change', function (event) {
8953
8953
  var state = event.state;
8954
8954
  var _uiState = event._uiState;
@@ -10773,7 +10773,7 @@
10773
10773
  *
10774
10774
  * It always generates the full URL, not a relative one.
10775
10775
  * This allows to handle cases like using a <base href>.
10776
- * See: https://github.com/algolia/instantsearch.js/issues/790
10776
+ * See: https://github.com/algolia/instantsearch/issues/790
10777
10777
  */
10778
10778
  }, {
10779
10779
  key: "createURL",
@@ -11262,7 +11262,7 @@
11262
11262
  };
11263
11263
  }
11264
11264
 
11265
- var version$2 = '4.56.9';
11265
+ var version$2 = '4.56.11';
11266
11266
 
11267
11267
  function _typeof$j(obj) {
11268
11268
  "@babel/helpers - typeof";
@@ -11852,7 +11852,7 @@
11852
11852
  /**
11853
11853
  * Removes all widgets without triggering a search afterwards. This is an **EXPERIMENTAL** feature,
11854
11854
  * if you find an issue with it, please
11855
- * [open an issue](https://github.com/algolia/instantsearch.js/issues/new?title=Problem%20with%20dispose).
11855
+ * [open an issue](https://github.com/algolia/instantsearch/issues/new?title=Problem%20with%20dispose).
11856
11856
  * @return {undefined} This method does not return anything
11857
11857
  */
11858
11858
  }, {
@@ -12000,7 +12000,7 @@
12000
12000
  if (searchRef.current === null) {
12001
12001
  // We don't use the `instantsearch()` function because it comes with other
12002
12002
  // top-level APIs that we don't need.
12003
- // See https://github.com/algolia/instantsearch.js/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
12003
+ // See https://github.com/algolia/instantsearch/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
12004
12004
  var search = new InstantSearch(props);
12005
12005
  search._schedule = function _schedule(cb) {
12006
12006
  search._schedule.queue.push(cb);
@@ -17206,7 +17206,7 @@
17206
17206
 
17207
17207
  // Results can be `null` when the first search is stalled.
17208
17208
  // In this case, we skip the update.
17209
- // See: https://github.com/algolia/instantsearch.js/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
17209
+ // See: https://github.com/algolia/instantsearch/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
17210
17210
  if (results !== null) {
17211
17211
  setSearchResults({
17212
17212
  results: results,
@@ -17399,13 +17399,18 @@
17399
17399
  var initialResults = {};
17400
17400
  walkIndex(rootIndex, function (widget) {
17401
17401
  var searchResults = widget.getResults();
17402
- initialResults[widget.getIndexId()] = {
17403
- // We convert the Helper state to a plain object to pass parsable data
17404
- // structures from server to client.
17405
- state: _objectSpread$v({}, searchResults._state),
17406
- results: searchResults._rawResults
17407
- };
17402
+ if (searchResults) {
17403
+ initialResults[widget.getIndexId()] = {
17404
+ // We convert the Helper state to a plain object to pass parsable data
17405
+ // structures from server to client.
17406
+ state: _objectSpread$v({}, searchResults._state),
17407
+ results: searchResults._rawResults
17408
+ };
17409
+ }
17408
17410
  });
17411
+ if (Object.keys(initialResults).length === 0) {
17412
+ throw new Error('The root index does not have any results. Make sure you have at least one widget that provides results.');
17413
+ }
17409
17414
  return initialResults;
17410
17415
  }
17411
17416