instantsearch.js 4.56.9 → 4.56.10

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/cjs/lib/server.js CHANGED
@@ -49,12 +49,17 @@ function getInitialResults(rootIndex) {
49
49
  var initialResults = {};
50
50
  (0, _utils.walkIndex)(rootIndex, function (widget) {
51
51
  var searchResults = widget.getResults();
52
- initialResults[widget.getIndexId()] = {
53
- // We convert the Helper state to a plain object to pass parsable data
54
- // structures from server to client.
55
- state: _objectSpread({}, searchResults._state),
56
- results: searchResults._rawResults
57
- };
52
+ if (searchResults) {
53
+ initialResults[widget.getIndexId()] = {
54
+ // We convert the Helper state to a plain object to pass parsable data
55
+ // structures from server to client.
56
+ state: _objectSpread({}, searchResults._state),
57
+ results: searchResults._rawResults
58
+ };
59
+ }
58
60
  });
61
+ if (Object.keys(initialResults).length === 0) {
62
+ throw new Error('The root index does not have any results. Make sure you have at least one widget that provides results.');
63
+ }
59
64
  return initialResults;
60
65
  }
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.56.9';
7
+ var _default = '4.56.10';
8
8
  exports.default = _default;
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.56.9 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.56.10 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -14617,7 +14617,7 @@
14617
14617
  };
14618
14618
  }
14619
14619
 
14620
- var version$1 = '4.56.9';
14620
+ var version$1 = '4.56.10';
14621
14621
 
14622
14622
  var withUsage$r = createDocumentationMessageGenerator({
14623
14623
  name: 'instantsearch'