react-instantsearch-core 7.7.1 → 7.7.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/dist/cjs/lib/useSearchResults.js +9 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/lib/useSearchResults.js +9 -0
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +505 -29
- package/dist/umd/ReactInstantSearchCore.js.map +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useSearchResults = useSearchResults;
|
|
7
|
+
var _utils = require("instantsearch.js/cjs/lib/utils");
|
|
7
8
|
var _react = require("react");
|
|
8
9
|
var _getIndexSearchResults = require("./getIndexSearchResults");
|
|
9
10
|
var _useIndexContext = require("./useIndexContext");
|
|
@@ -35,6 +36,14 @@ function useSearchResults() {
|
|
|
35
36
|
results: results,
|
|
36
37
|
scopedResults: searchIndex.getScopedResults()
|
|
37
38
|
});
|
|
39
|
+
} else if (search.mainIndex.getIndexName().length === 0) {
|
|
40
|
+
// If the main index has no name, we get the scoped results from
|
|
41
|
+
// the first child index instead.
|
|
42
|
+
var childIndex = search.mainIndex.getWidgets().find(_utils.isIndexWidget);
|
|
43
|
+
childIndex && setSearchResults({
|
|
44
|
+
results: (0, _getIndexSearchResults.getIndexSearchResults)(searchIndex).results,
|
|
45
|
+
scopedResults: childIndex.getScopedResults()
|
|
46
|
+
});
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
search.addListener('render', handleRender);
|
package/dist/cjs/version.js
CHANGED
|
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { isIndexWidget } from "instantsearch.js/es/lib/utils/index.js";
|
|
7
8
|
import { useEffect, useState } from 'react';
|
|
8
9
|
import { getIndexSearchResults } from "./getIndexSearchResults.js";
|
|
9
10
|
import { useIndexContext } from "./useIndexContext.js";
|
|
@@ -29,6 +30,14 @@ export function useSearchResults() {
|
|
|
29
30
|
results: results,
|
|
30
31
|
scopedResults: searchIndex.getScopedResults()
|
|
31
32
|
});
|
|
33
|
+
} else if (search.mainIndex.getIndexName().length === 0) {
|
|
34
|
+
// If the main index has no name, we get the scoped results from
|
|
35
|
+
// the first child index instead.
|
|
36
|
+
var childIndex = search.mainIndex.getWidgets().find(isIndexWidget);
|
|
37
|
+
childIndex && setSearchResults({
|
|
38
|
+
results: getIndexSearchResults(searchIndex).results,
|
|
39
|
+
scopedResults: childIndex.getScopedResults()
|
|
40
|
+
});
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
43
|
search.addListener('render', handleRender);
|
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.7.
|
|
1
|
+
declare const _default: "7.7.3";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '7.7.
|
|
1
|
+
export default '7.7.3';
|