react-instantsearch-core 7.39.1 → 7.40.0
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/hooks/useConnector.js +4 -1
- package/dist/cjs/lib/InstantSearchRSCContext.js +3 -0
- package/dist/cjs/server/getServerState.js +7 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/hooks/useConnector.js +4 -1
- package/dist/es/lib/InstantSearchRSCContext.d.ts +1 -0
- package/dist/es/lib/InstantSearchRSCContext.js +3 -0
- package/dist/es/server/getServerState.js +7 -0
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +101 -49
- package/dist/umd/ReactInstantSearchCore.min.js +3 -3
- package/package.json +3 -3
|
@@ -126,7 +126,10 @@ function useConnector(connector) {
|
|
|
126
126
|
(0, _useWidget.useWidget)({
|
|
127
127
|
widget: widget,
|
|
128
128
|
parentIndex: parentIndex,
|
|
129
|
-
props:
|
|
129
|
+
props: [
|
|
130
|
+
stableProps,
|
|
131
|
+
stableAdditionalWidgetProperties
|
|
132
|
+
],
|
|
130
133
|
shouldSsr: Boolean(serverContext),
|
|
131
134
|
skipSuspense: skipSuspense
|
|
132
135
|
});
|
|
@@ -42,6 +42,13 @@ function getServerState(children, param) {
|
|
|
42
42
|
var shouldRefetch = false;
|
|
43
43
|
// Two-pass widgets require another query to discover and mount child widgets.
|
|
44
44
|
(0, _utils.walkIndex)(searchRef.current.mainIndex, function(index) {
|
|
45
|
+
var current = index;
|
|
46
|
+
while(current){
|
|
47
|
+
if (current._isolated) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
current = current.getParent();
|
|
51
|
+
}
|
|
45
52
|
shouldRefetch = shouldRefetch || index.getWidgets().some(_utils.isTwoPassWidget);
|
|
46
53
|
});
|
|
47
54
|
if (shouldRefetch) {
|
package/dist/cjs/version.js
CHANGED
|
@@ -116,7 +116,10 @@ function useConnector(connector) {
|
|
|
116
116
|
useWidget({
|
|
117
117
|
widget: widget,
|
|
118
118
|
parentIndex: parentIndex,
|
|
119
|
-
props:
|
|
119
|
+
props: [
|
|
120
|
+
stableProps,
|
|
121
|
+
stableAdditionalWidgetProperties
|
|
122
|
+
],
|
|
120
123
|
shouldSsr: Boolean(serverContext),
|
|
121
124
|
skipSuspense: skipSuspense
|
|
122
125
|
});
|
|
@@ -2,6 +2,7 @@ import type { PromiseWithState } from './wrapPromiseWithState';
|
|
|
2
2
|
import type { RefObject } from 'react';
|
|
3
3
|
export type InstantSearchRSCContextApi = {
|
|
4
4
|
waitForResultsRef: RefObject<PromiseWithState<void> | null> | null;
|
|
5
|
+
resolveWaitForResultsRef?: RefObject<(() => void) | null>;
|
|
5
6
|
countRef: RefObject<number>;
|
|
6
7
|
ignoreMultipleHooksWarning: boolean;
|
|
7
8
|
};
|
|
@@ -33,6 +33,13 @@ import { InstantSearchSSRProvider } from '../components/InstantSearchSSRProvider
|
|
|
33
33
|
var shouldRefetch = false;
|
|
34
34
|
// Two-pass widgets require another query to discover and mount child widgets.
|
|
35
35
|
walkIndex(searchRef.current.mainIndex, function(index) {
|
|
36
|
+
var current = index;
|
|
37
|
+
while(current){
|
|
38
|
+
if (current._isolated) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
current = current.getParent();
|
|
42
|
+
}
|
|
36
43
|
shouldRefetch = shouldRefetch || index.getWidgets().some(isTwoPassWidget);
|
|
37
44
|
});
|
|
38
45
|
if (shouldRefetch) {
|
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.
|
|
1
|
+
declare const _default: "7.40.0";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch Core 7.
|
|
1
|
+
/*! React InstantSearch Core 7.40.0 | © Algolia, Inc. and contributors; MIT License | 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) :
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
26
|
|
|
27
|
-
var version$2 = '7.
|
|
27
|
+
var version$2 = '7.40.0';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -7528,6 +7528,9 @@
|
|
|
7528
7528
|
current: 0
|
|
7529
7529
|
},
|
|
7530
7530
|
waitForResultsRef: null,
|
|
7531
|
+
resolveWaitForResultsRef: {
|
|
7532
|
+
current: null
|
|
7533
|
+
},
|
|
7531
7534
|
ignoreMultipleHooksWarning: false
|
|
7532
7535
|
});
|
|
7533
7536
|
|
|
@@ -7762,7 +7765,10 @@
|
|
|
7762
7765
|
useWidget({
|
|
7763
7766
|
widget: widget,
|
|
7764
7767
|
parentIndex: parentIndex,
|
|
7765
|
-
props:
|
|
7768
|
+
props: [
|
|
7769
|
+
stableProps,
|
|
7770
|
+
stableAdditionalWidgetProperties
|
|
7771
|
+
],
|
|
7766
7772
|
shouldSsr: Boolean(serverContext),
|
|
7767
7773
|
skipSuspense: skipSuspense
|
|
7768
7774
|
});
|
|
@@ -8499,6 +8505,39 @@
|
|
|
8499
8505
|
].concat(_to_consumable_array(resolveScopedResultsFromWidgets(current.getWidgets()))));
|
|
8500
8506
|
}, []);
|
|
8501
8507
|
}
|
|
8508
|
+
function getWidgetsRequestDependencies(widgets) {
|
|
8509
|
+
return widgets.reduce(function(dependencies, widget) {
|
|
8510
|
+
if (isIndexWidget(widget)) {
|
|
8511
|
+
if (widget._isolated) {
|
|
8512
|
+
return dependencies;
|
|
8513
|
+
}
|
|
8514
|
+
var childDependencies = getWidgetsRequestDependencies(widget.getWidgets());
|
|
8515
|
+
return {
|
|
8516
|
+
hasSearchWidget: dependencies.hasSearchWidget || childDependencies.hasSearchWidget,
|
|
8517
|
+
hasRecommendWidget: dependencies.hasRecommendWidget || childDependencies.hasRecommendWidget
|
|
8518
|
+
};
|
|
8519
|
+
}
|
|
8520
|
+
if (widget.dependsOn === 'recommend') {
|
|
8521
|
+
return _object_spread_props(_object_spread({}, dependencies), {
|
|
8522
|
+
hasRecommendWidget: true
|
|
8523
|
+
});
|
|
8524
|
+
}
|
|
8525
|
+
if (widget.dependsOn === 'none') {
|
|
8526
|
+
return dependencies;
|
|
8527
|
+
}
|
|
8528
|
+
return _object_spread_props(_object_spread({}, dependencies), {
|
|
8529
|
+
hasSearchWidget: true
|
|
8530
|
+
});
|
|
8531
|
+
}, {
|
|
8532
|
+
hasSearchWidget: false,
|
|
8533
|
+
hasRecommendWidget: false
|
|
8534
|
+
});
|
|
8535
|
+
}
|
|
8536
|
+
function recomputeInstantSearchRequestDependencies(instantSearchInstance) {
|
|
8537
|
+
var _getWidgetsRequestDependencies = getWidgetsRequestDependencies(instantSearchInstance.mainIndex.getWidgets()), hasSearchWidget = _getWidgetsRequestDependencies.hasSearchWidget, hasRecommendWidget = _getWidgetsRequestDependencies.hasRecommendWidget;
|
|
8538
|
+
instantSearchInstance._hasSearchWidget = hasSearchWidget;
|
|
8539
|
+
instantSearchInstance._hasRecommendWidget = hasRecommendWidget;
|
|
8540
|
+
}
|
|
8502
8541
|
var index = function index(widgetParams) {
|
|
8503
8542
|
if (widgetParams === undefined || widgetParams.indexName === undefined && !widgetParams.EXPERIMENTAL_isolated) {
|
|
8504
8543
|
throw new Error(withUsage$s('The `indexName` option is required.'));
|
|
@@ -8513,8 +8552,11 @@
|
|
|
8513
8552
|
var helper = null;
|
|
8514
8553
|
var derivedHelper = null;
|
|
8515
8554
|
var lastValidSearchParameters = null;
|
|
8516
|
-
var
|
|
8517
|
-
|
|
8555
|
+
var recomputeLocalRequestDependencies = function recomputeLocalRequestDependencies() {
|
|
8556
|
+
if (localInstantSearchInstance) {
|
|
8557
|
+
recomputeInstantSearchRequestDependencies(localInstantSearchInstance);
|
|
8558
|
+
}
|
|
8559
|
+
};
|
|
8518
8560
|
return {
|
|
8519
8561
|
$$type: 'ais.index',
|
|
8520
8562
|
$$widgetType: 'ais.index',
|
|
@@ -8605,21 +8647,12 @@
|
|
|
8605
8647
|
}
|
|
8606
8648
|
flatWidgets.forEach(function(widget) {
|
|
8607
8649
|
widget.parent = _this;
|
|
8608
|
-
if (isIndexWidget(widget)) {
|
|
8609
|
-
|
|
8650
|
+
if (!isIndexWidget(widget)) {
|
|
8651
|
+
addWidgetId(widget);
|
|
8610
8652
|
}
|
|
8611
|
-
if (localInstantSearchInstance && widget.dependsOn === 'recommend') {
|
|
8612
|
-
localInstantSearchInstance._hasRecommendWidget = true;
|
|
8613
|
-
} else if (localInstantSearchInstance) {
|
|
8614
|
-
localInstantSearchInstance._hasSearchWidget = true;
|
|
8615
|
-
} else if (widget.dependsOn === 'recommend') {
|
|
8616
|
-
hasRecommendWidget = true;
|
|
8617
|
-
} else {
|
|
8618
|
-
hasSearchWidget = true;
|
|
8619
|
-
}
|
|
8620
|
-
addWidgetId(widget);
|
|
8621
8653
|
});
|
|
8622
8654
|
localWidgets = localWidgets.concat(flatWidgets);
|
|
8655
|
+
recomputeLocalRequestDependencies();
|
|
8623
8656
|
if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
|
|
8624
8657
|
privateHelperSetState(helper, {
|
|
8625
8658
|
state: getLocalWidgetsSearchParameters(localWidgets, {
|
|
@@ -8676,21 +8709,10 @@
|
|
|
8676
8709
|
localWidgets = localWidgets.filter(function(widget) {
|
|
8677
8710
|
return flatWidgets.indexOf(widget) === -1;
|
|
8678
8711
|
});
|
|
8679
|
-
|
|
8712
|
+
flatWidgets.forEach(function(widget) {
|
|
8680
8713
|
widget.parent = undefined;
|
|
8681
|
-
if (isIndexWidget(widget)) {
|
|
8682
|
-
return;
|
|
8683
|
-
}
|
|
8684
|
-
if (localInstantSearchInstance && widget.dependsOn === 'recommend') {
|
|
8685
|
-
localInstantSearchInstance._hasRecommendWidget = true;
|
|
8686
|
-
} else if (localInstantSearchInstance) {
|
|
8687
|
-
localInstantSearchInstance._hasSearchWidget = true;
|
|
8688
|
-
} else if (widget.dependsOn === 'recommend') {
|
|
8689
|
-
hasRecommendWidget = true;
|
|
8690
|
-
} else {
|
|
8691
|
-
hasSearchWidget = true;
|
|
8692
|
-
}
|
|
8693
8714
|
});
|
|
8715
|
+
recomputeLocalRequestDependencies();
|
|
8694
8716
|
if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
|
|
8695
8717
|
var _flatWidgets_reduce = flatWidgets.reduce(function(states, widget) {
|
|
8696
8718
|
// the `dispose` method exists at this point we already assert it
|
|
@@ -8913,12 +8935,7 @@
|
|
|
8913
8935
|
// schedule a render that will render the results injected on the helper.
|
|
8914
8936
|
instantSearchInstance.scheduleRender();
|
|
8915
8937
|
}
|
|
8916
|
-
|
|
8917
|
-
instantSearchInstance._hasRecommendWidget = true;
|
|
8918
|
-
}
|
|
8919
|
-
if (hasSearchWidget) {
|
|
8920
|
-
instantSearchInstance._hasSearchWidget = true;
|
|
8921
|
-
}
|
|
8938
|
+
recomputeLocalRequestDependencies();
|
|
8922
8939
|
},
|
|
8923
8940
|
render: function render(param) {
|
|
8924
8941
|
var _this = this;
|
|
@@ -9192,7 +9209,7 @@
|
|
|
9192
9209
|
});
|
|
9193
9210
|
}
|
|
9194
9211
|
|
|
9195
|
-
var version = '4.
|
|
9212
|
+
var version = '4.107.0';
|
|
9196
9213
|
|
|
9197
9214
|
var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
|
|
9198
9215
|
function getCookie(name) {
|
|
@@ -11333,8 +11350,11 @@
|
|
|
11333
11350
|
mainHelper.searchForFacetValues = mainHelper.searchForCompositionFacetValues.bind(mainHelper);
|
|
11334
11351
|
}
|
|
11335
11352
|
mainHelper.search = function() {
|
|
11336
|
-
_this.
|
|
11337
|
-
|
|
11353
|
+
var hasSearchOrRecommendWidget = _this._hasSearchWidget || _this._hasRecommendWidget;
|
|
11354
|
+
if (hasSearchOrRecommendWidget) {
|
|
11355
|
+
_this.status = 'loading';
|
|
11356
|
+
}
|
|
11357
|
+
_this.scheduleRender(!hasSearchOrRecommendWidget);
|
|
11338
11358
|
// This solution allows us to keep the exact same API for the users but
|
|
11339
11359
|
// under the hood, we have a different implementation. It should be
|
|
11340
11360
|
// completely transparent for the rest of the codebase. Only this module
|
|
@@ -11398,7 +11418,7 @@
|
|
|
11398
11418
|
error.error = error;
|
|
11399
11419
|
_this.error = error;
|
|
11400
11420
|
_this.status = 'error';
|
|
11401
|
-
_this.scheduleRender(
|
|
11421
|
+
_this.scheduleRender(!_this._hasSearchWidget && !_this._hasRecommendWidget);
|
|
11402
11422
|
// This needs to execute last because it throws the error.
|
|
11403
11423
|
_this.emit('error', error);
|
|
11404
11424
|
});
|
|
@@ -12106,10 +12126,14 @@
|
|
|
12106
12126
|
return function(widgetParams) {
|
|
12107
12127
|
var _ref = widgetParams || {}, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(indices) {
|
|
12108
12128
|
return indices;
|
|
12109
|
-
} : _ref_transformItems, tmp = _ref.future, _ref1 = tmp === void 0 ? {} : tmp, _ref_undefinedEmptyQuery = _ref1.undefinedEmptyQuery, undefinedEmptyQuery = _ref_undefinedEmptyQuery === void 0 ? false : _ref_undefinedEmptyQuery;
|
|
12129
|
+
} : _ref_transformItems, _ref_requiresSearch = _ref.requiresSearch, requiresSearch = _ref_requiresSearch === void 0 ? true : _ref_requiresSearch, tmp = _ref.future, _ref1 = tmp === void 0 ? {} : tmp, _ref_undefinedEmptyQuery = _ref1.undefinedEmptyQuery, undefinedEmptyQuery = _ref_undefinedEmptyQuery === void 0 ? false : _ref_undefinedEmptyQuery;
|
|
12110
12130
|
var connectorState = {};
|
|
12111
12131
|
return {
|
|
12112
12132
|
$$type: 'ais.autocomplete',
|
|
12133
|
+
dependsOn: requiresSearch ? 'search' : 'none',
|
|
12134
|
+
shouldRender: requiresSearch ? undefined : function() {
|
|
12135
|
+
return true;
|
|
12136
|
+
},
|
|
12113
12137
|
init: function init(initOptions) {
|
|
12114
12138
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
12115
12139
|
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
@@ -14143,14 +14167,16 @@
|
|
|
14143
14167
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
14144
14168
|
checkRendering(renderFn, withUsage$o());
|
|
14145
14169
|
return function(widgetParams) {
|
|
14146
|
-
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, context = _ref.context, initialUserMessage = _ref.initialUserMessage, initialMessages = _ref.initialMessages, _ref_disableTriggerValidation = _ref.disableTriggerValidation, disableTriggerValidation = _ref_disableTriggerValidation === void 0 ? false : _ref_disableTriggerValidation, options = _object_without_properties(_ref, [
|
|
14170
|
+
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, context = _ref.context, initialUserMessage = _ref.initialUserMessage, initialMessages = _ref.initialMessages, _ref_disableTriggerValidation = _ref.disableTriggerValidation, disableTriggerValidation = _ref_disableTriggerValidation === void 0 ? false : _ref_disableTriggerValidation, _ref_sendAutomaticallyWhen = _ref.sendAutomaticallyWhen, sendAutomaticallyWhen = _ref_sendAutomaticallyWhen === void 0 ? lastAssistantMessageIsCompleteWithToolCalls : _ref_sendAutomaticallyWhen, _ref_requiresSearch = _ref.requiresSearch, requiresSearch = _ref_requiresSearch === void 0 ? true : _ref_requiresSearch, options = _object_without_properties(_ref, [
|
|
14147
14171
|
"resume",
|
|
14148
14172
|
"tools",
|
|
14149
14173
|
"type",
|
|
14150
14174
|
"context",
|
|
14151
14175
|
"initialUserMessage",
|
|
14152
14176
|
"initialMessages",
|
|
14153
|
-
"disableTriggerValidation"
|
|
14177
|
+
"disableTriggerValidation",
|
|
14178
|
+
"sendAutomaticallyWhen",
|
|
14179
|
+
"requiresSearch"
|
|
14154
14180
|
]);
|
|
14155
14181
|
var _chatInstance;
|
|
14156
14182
|
var input = '';
|
|
@@ -14311,8 +14337,8 @@
|
|
|
14311
14337
|
return options.chat;
|
|
14312
14338
|
}
|
|
14313
14339
|
return new Chat(_object_spread_props(_object_spread({}, options), {
|
|
14340
|
+
sendAutomaticallyWhen: sendAutomaticallyWhen,
|
|
14314
14341
|
transport: transport,
|
|
14315
|
-
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
14316
14342
|
shouldRepairToolInput: function shouldRepairToolInput(toolName) {
|
|
14317
14343
|
var tool = tools[toolName];
|
|
14318
14344
|
if (!tool && toolName.startsWith("".concat(SearchIndexToolType, "_"))) {
|
|
@@ -14354,6 +14380,7 @@
|
|
|
14354
14380
|
};
|
|
14355
14381
|
return {
|
|
14356
14382
|
$$type: 'ais.chat',
|
|
14383
|
+
dependsOn: requiresSearch ? 'search' : 'none',
|
|
14357
14384
|
init: function init(initOptions) {
|
|
14358
14385
|
var _this = this;
|
|
14359
14386
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
@@ -14566,6 +14593,7 @@
|
|
|
14566
14593
|
return {
|
|
14567
14594
|
$$type: 'ais.chatTrigger',
|
|
14568
14595
|
opensChat: true,
|
|
14596
|
+
dependsOn: 'none',
|
|
14569
14597
|
init: function init(initOptions) {
|
|
14570
14598
|
lastOptions = initOptions;
|
|
14571
14599
|
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
@@ -14594,6 +14622,9 @@
|
|
|
14594
14622
|
return _object_spread_props(_object_spread({}, renderState), {
|
|
14595
14623
|
chatTrigger: this.getWidgetRenderState(renderOptions)
|
|
14596
14624
|
});
|
|
14625
|
+
},
|
|
14626
|
+
shouldRender: function shouldRender() {
|
|
14627
|
+
return true;
|
|
14597
14628
|
}
|
|
14598
14629
|
};
|
|
14599
14630
|
};
|
|
@@ -18534,6 +18565,8 @@
|
|
|
18534
18565
|
// later during hydration.
|
|
18535
18566
|
var requestParamsList;
|
|
18536
18567
|
var client = helper.getClient();
|
|
18568
|
+
var waitsForSearch = search._hasSearchWidget;
|
|
18569
|
+
var waitsForRecommend = !skipRecommend && search._hasRecommendWidget;
|
|
18537
18570
|
if (search.compositionID) {
|
|
18538
18571
|
helper.setClient(_object_spread_props(_object_spread({}, client), {
|
|
18539
18572
|
search: function search(query) {
|
|
@@ -18554,17 +18587,22 @@
|
|
|
18554
18587
|
}
|
|
18555
18588
|
}));
|
|
18556
18589
|
}
|
|
18557
|
-
if (
|
|
18590
|
+
if (waitsForSearch) {
|
|
18558
18591
|
if (search.compositionID) {
|
|
18559
18592
|
helper.searchWithComposition();
|
|
18560
18593
|
} else {
|
|
18561
18594
|
helper.searchOnlyWithDerivedHelpers();
|
|
18562
18595
|
}
|
|
18563
18596
|
}
|
|
18564
|
-
|
|
18597
|
+
if (waitsForRecommend) {
|
|
18598
|
+
helper.recommend();
|
|
18599
|
+
}
|
|
18600
|
+
if (!waitsForSearch && !waitsForRecommend) {
|
|
18601
|
+
return Promise.resolve([]);
|
|
18602
|
+
}
|
|
18565
18603
|
return new Promise(function(resolve, reject) {
|
|
18566
|
-
var searchResultsReceived = !
|
|
18567
|
-
var recommendResultsReceived = !
|
|
18604
|
+
var searchResultsReceived = !waitsForSearch;
|
|
18605
|
+
var recommendResultsReceived = !waitsForRecommend;
|
|
18568
18606
|
// All derived helpers resolve in the same tick so we're safe only relying
|
|
18569
18607
|
// on the first one.
|
|
18570
18608
|
helper.derivedHelpers[0].on('result', function() {
|
|
@@ -18604,6 +18642,13 @@
|
|
|
18604
18642
|
var requestParamsIndex = 0;
|
|
18605
18643
|
walkIndex(rootIndex, function(widget) {
|
|
18606
18644
|
var _widget_getHelper;
|
|
18645
|
+
var currentIndex = widget;
|
|
18646
|
+
while(currentIndex){
|
|
18647
|
+
if (currentIndex._isolated) {
|
|
18648
|
+
return;
|
|
18649
|
+
}
|
|
18650
|
+
currentIndex = currentIndex.getParent();
|
|
18651
|
+
}
|
|
18607
18652
|
var searchResults = widget.getResults();
|
|
18608
18653
|
var recommendResults = (_widget_getHelper = widget.getHelper()) === null || _widget_getHelper === void 0 ? void 0 : _widget_getHelper.lastRecommendResults;
|
|
18609
18654
|
if (searchResults || recommendResults) {
|
|
@@ -18634,7 +18679,7 @@
|
|
|
18634
18679
|
});
|
|
18635
18680
|
}
|
|
18636
18681
|
});
|
|
18637
|
-
if (Object.keys(initialResults).length === 0) {
|
|
18682
|
+
if (Object.keys(initialResults).length === 0 && (requestParamsList === null || requestParamsList === void 0 ? void 0 : requestParamsList.length) !== 0) {
|
|
18638
18683
|
throw new Error('The root index does not have any results. Make sure you have at least one widget that provides results.');
|
|
18639
18684
|
}
|
|
18640
18685
|
return initialResults;
|
|
@@ -18669,6 +18714,13 @@
|
|
|
18669
18714
|
var shouldRefetch = false;
|
|
18670
18715
|
// Two-pass widgets require another query to discover and mount child widgets.
|
|
18671
18716
|
walkIndex(searchRef.current.mainIndex, function(index) {
|
|
18717
|
+
var current = index;
|
|
18718
|
+
while(current){
|
|
18719
|
+
if (current._isolated) {
|
|
18720
|
+
return;
|
|
18721
|
+
}
|
|
18722
|
+
current = current.getParent();
|
|
18723
|
+
}
|
|
18672
18724
|
shouldRefetch = shouldRefetch || index.getWidgets().some(isTwoPassWidget);
|
|
18673
18725
|
});
|
|
18674
18726
|
if (shouldRefetch) {
|