react-instantsearch 7.16.0 → 7.16.1
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.
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var React__default = 'default' in React ? React['default'] : React;
|
|
9
9
|
|
|
10
|
-
var version = '7.16.
|
|
10
|
+
var version = '7.16.1';
|
|
11
11
|
|
|
12
12
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
13
13
|
//
|
|
@@ -9575,19 +9575,29 @@
|
|
|
9575
9575
|
*/
|
|
9576
9576
|
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
9577
9577
|
|
|
9578
|
-
var InstantSearchRSCContext = /*#__PURE__*/React.createContext(
|
|
9578
|
+
var InstantSearchRSCContext = /*#__PURE__*/React.createContext({
|
|
9579
|
+
countRef: {
|
|
9580
|
+
current: 0
|
|
9581
|
+
},
|
|
9582
|
+
waitForResultsRef: null,
|
|
9583
|
+
ignoreMultipleHooksWarning: false
|
|
9584
|
+
});
|
|
9579
9585
|
|
|
9580
9586
|
function useRSCContext() {
|
|
9581
9587
|
return React.useContext(InstantSearchRSCContext);
|
|
9582
9588
|
}
|
|
9583
9589
|
|
|
9584
9590
|
function useWidget(_ref) {
|
|
9585
|
-
var
|
|
9591
|
+
var _waitForResultsRef$cu, _waitForResultsRef$cu2;
|
|
9586
9592
|
var widget = _ref.widget,
|
|
9587
9593
|
parentIndex = _ref.parentIndex,
|
|
9588
9594
|
props = _ref.props,
|
|
9589
|
-
shouldSsr = _ref.shouldSsr
|
|
9590
|
-
|
|
9595
|
+
shouldSsr = _ref.shouldSsr,
|
|
9596
|
+
skipSuspense = _ref.skipSuspense;
|
|
9597
|
+
var _useRSCContext = useRSCContext(),
|
|
9598
|
+
waitForResultsRef = _useRSCContext.waitForResultsRef,
|
|
9599
|
+
countRef = _useRSCContext.countRef,
|
|
9600
|
+
ignoreMultipleHooksWarning = _useRSCContext.ignoreMultipleHooksWarning;
|
|
9591
9601
|
var prevPropsRef = React.useRef(props);
|
|
9592
9602
|
React.useEffect(function () {
|
|
9593
9603
|
prevPropsRef.current = props;
|
|
@@ -9647,20 +9657,21 @@
|
|
|
9647
9657
|
});
|
|
9648
9658
|
};
|
|
9649
9659
|
}, [parentIndex, widget, shouldSsr, search, props]);
|
|
9650
|
-
if (shouldAddWidgetEarly || (
|
|
9660
|
+
if (shouldAddWidgetEarly || (waitForResultsRef === null || waitForResultsRef === void 0 ? void 0 : (_waitForResultsRef$cu = waitForResultsRef.current) === null || _waitForResultsRef$cu === void 0 ? void 0 : _waitForResultsRef$cu.status) === 'pending') {
|
|
9651
9661
|
parentIndex.addWidgets([widget]);
|
|
9652
9662
|
}
|
|
9653
|
-
if (
|
|
9654
|
-
// We need the widgets contained in the index to be added before we trigger the search request.
|
|
9655
|
-
widget.$$type !== 'ais.index') {
|
|
9663
|
+
if (waitForResultsRef !== null && waitForResultsRef !== void 0 && waitForResultsRef.current && !skipSuspense) {
|
|
9656
9664
|
var _search$helper;
|
|
9657
|
-
use(
|
|
9665
|
+
use(waitForResultsRef.current);
|
|
9658
9666
|
// If we made a second request because of DynamicWidgets, we need to wait for the second result,
|
|
9659
9667
|
// except for DynamicWidgets itself which needs to render its children after the first result.
|
|
9660
9668
|
if (widget.$$type !== 'ais.dynamicWidgets' && (_search$helper = search.helper) !== null && _search$helper !== void 0 && _search$helper.lastResults) {
|
|
9661
|
-
use(
|
|
9669
|
+
use(waitForResultsRef.current);
|
|
9662
9670
|
}
|
|
9663
9671
|
}
|
|
9672
|
+
if ((waitForResultsRef === null || waitForResultsRef === void 0 ? void 0 : (_waitForResultsRef$cu2 = waitForResultsRef.current) === null || _waitForResultsRef$cu2 === void 0 ? void 0 : _waitForResultsRef$cu2.status) === 'fulfilled') {
|
|
9673
|
+
countRef.current += 1;
|
|
9674
|
+
}
|
|
9664
9675
|
}
|
|
9665
9676
|
|
|
9666
9677
|
function _typeof$d(o) {
|
|
@@ -9672,8 +9683,9 @@
|
|
|
9672
9683
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
9673
9684
|
}, _typeof$d(o);
|
|
9674
9685
|
}
|
|
9675
|
-
var _excluded$1 = ["
|
|
9676
|
-
_excluded2 = ["widgetParams"]
|
|
9686
|
+
var _excluded$1 = ["skipSuspense"],
|
|
9687
|
+
_excluded2 = ["instantSearchInstance", "widgetParams"],
|
|
9688
|
+
_excluded3 = ["widgetParams"];
|
|
9677
9689
|
function _slicedToArray$5(arr, i) {
|
|
9678
9690
|
return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i) || _unsupportedIterableToArray$6(arr, i) || _nonIterableRest$5();
|
|
9679
9691
|
}
|
|
@@ -9801,7 +9813,10 @@
|
|
|
9801
9813
|
}
|
|
9802
9814
|
function useConnector(connector) {
|
|
9803
9815
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9804
|
-
var
|
|
9816
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
9817
|
+
_ref$skipSuspense = _ref.skipSuspense,
|
|
9818
|
+
skipSuspense = _ref$skipSuspense === void 0 ? false : _ref$skipSuspense,
|
|
9819
|
+
additionalWidgetProperties = _objectWithoutProperties$1(_ref, _excluded$1);
|
|
9805
9820
|
var serverContext = useInstantSearchServerContext();
|
|
9806
9821
|
var ssrContext = useInstantSearchSSRContext();
|
|
9807
9822
|
var search = useInstantSearchContext();
|
|
@@ -9835,7 +9850,7 @@
|
|
|
9835
9850
|
if (shouldSetStateRef.current) {
|
|
9836
9851
|
var instantSearchInstance = connectorState.instantSearchInstance,
|
|
9837
9852
|
widgetParams = connectorState.widgetParams,
|
|
9838
|
-
renderState = _objectWithoutProperties$1(connectorState,
|
|
9853
|
+
renderState = _objectWithoutProperties$1(connectorState, _excluded2);
|
|
9839
9854
|
|
|
9840
9855
|
// We only update the state when a widget render state param changes,
|
|
9841
9856
|
// except for functions. We ignore function reference changes to avoid
|
|
@@ -9891,7 +9906,7 @@
|
|
|
9891
9906
|
error: search.error
|
|
9892
9907
|
}),
|
|
9893
9908
|
widgetParams = _widget$getWidgetRend.widgetParams,
|
|
9894
|
-
renderState = _objectWithoutProperties$1(_widget$getWidgetRend,
|
|
9909
|
+
renderState = _objectWithoutProperties$1(_widget$getWidgetRend, _excluded3);
|
|
9895
9910
|
return renderState;
|
|
9896
9911
|
}
|
|
9897
9912
|
return {};
|
|
@@ -9903,7 +9918,8 @@
|
|
|
9903
9918
|
widget: widget,
|
|
9904
9919
|
parentIndex: parentIndex,
|
|
9905
9920
|
props: stableProps,
|
|
9906
|
-
shouldSsr: Boolean(serverContext)
|
|
9921
|
+
shouldSsr: Boolean(serverContext),
|
|
9922
|
+
skipSuspense: skipSuspense
|
|
9907
9923
|
});
|
|
9908
9924
|
return state;
|
|
9909
9925
|
}
|
|
@@ -11118,7 +11134,8 @@
|
|
|
11118
11134
|
widget: indexWidget,
|
|
11119
11135
|
parentIndex: parentIndex,
|
|
11120
11136
|
props: stableProps,
|
|
11121
|
-
shouldSsr: Boolean(serverContext || initialResults)
|
|
11137
|
+
shouldSsr: Boolean(serverContext || initialResults),
|
|
11138
|
+
skipSuspense: true
|
|
11122
11139
|
});
|
|
11123
11140
|
return indexWidget;
|
|
11124
11141
|
}
|
|
@@ -13451,7 +13468,7 @@
|
|
|
13451
13468
|
};
|
|
13452
13469
|
}
|
|
13453
13470
|
|
|
13454
|
-
var version$3 = '4.79.
|
|
13471
|
+
var version$3 = '4.79.1';
|
|
13455
13472
|
|
|
13456
13473
|
function _typeof$q(o) {
|
|
13457
13474
|
"@babel/helpers - typeof";
|
|
@@ -14307,15 +14324,16 @@
|
|
|
14307
14324
|
var forceUpdate = useForceUpdate();
|
|
14308
14325
|
var serverContext = useInstantSearchServerContext();
|
|
14309
14326
|
var serverState = useInstantSearchSSRContext();
|
|
14310
|
-
var
|
|
14327
|
+
var _useRSCContext = useRSCContext(),
|
|
14328
|
+
waitForResultsRef = _useRSCContext.waitForResultsRef;
|
|
14311
14329
|
var initialResults = serverState === null || serverState === void 0 ? void 0 : serverState.initialResults;
|
|
14312
14330
|
var prevPropsRef = React.useRef(props);
|
|
14313
|
-
var shouldRenderAtOnce = serverContext || initialResults ||
|
|
14331
|
+
var shouldRenderAtOnce = serverContext || initialResults || waitForResultsRef;
|
|
14314
14332
|
var searchRef = React.useRef(null);
|
|
14315
14333
|
// As we need to render on mount with SSR, using the local ref above in `StrictMode` will
|
|
14316
14334
|
// create and start two instances of InstantSearch. To avoid this, we instead discard it and use
|
|
14317
14335
|
// an upward ref from `InstantSearchSSRContext` as it has already been mounted a second time at this point.
|
|
14318
|
-
if (serverState) {
|
|
14336
|
+
if (serverState !== null && serverState !== void 0 && serverState.ssrSearchRef) {
|
|
14319
14337
|
searchRef = serverState.ssrSearchRef;
|
|
14320
14338
|
}
|
|
14321
14339
|
if (searchRef.current === null) {
|
|
@@ -14428,6 +14446,9 @@
|
|
|
14428
14446
|
search._preventWidgetCleanup = false;
|
|
14429
14447
|
}
|
|
14430
14448
|
return function () {
|
|
14449
|
+
if (serverState !== null && serverState !== void 0 && serverState.ssrSearchRef) {
|
|
14450
|
+
return;
|
|
14451
|
+
}
|
|
14431
14452
|
function cleanup() {
|
|
14432
14453
|
search.dispose();
|
|
14433
14454
|
}
|
|
@@ -14439,13 +14460,12 @@
|
|
|
14439
14460
|
// in the next effect.
|
|
14440
14461
|
// (There might be better ways to do this.)
|
|
14441
14462
|
cleanupTimerRef.current = setTimeout(cleanup);
|
|
14442
|
-
|
|
14443
14463
|
// We need to prevent the `useWidget` cleanup function so that widgets
|
|
14444
14464
|
// are not removed before the instance is disposed, triggering
|
|
14445
14465
|
// an unwanted search request.
|
|
14446
14466
|
search._preventWidgetCleanup = true;
|
|
14447
14467
|
};
|
|
14448
|
-
}, [forceUpdate]), function () {
|
|
14468
|
+
}, [forceUpdate, serverState]), function () {
|
|
14449
14469
|
return searchRef.current;
|
|
14450
14470
|
}, function () {
|
|
14451
14471
|
return searchRef.current;
|
|
@@ -21011,18 +21031,13 @@
|
|
|
21011
21031
|
|
|
21012
21032
|
var _extends_1 = createCommonjsModule(function (module) {
|
|
21013
21033
|
function _extends() {
|
|
21014
|
-
module.exports = _extends = Object.assign ? Object.assign.bind() : function (
|
|
21015
|
-
for (var
|
|
21016
|
-
var
|
|
21017
|
-
for (var
|
|
21018
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
21019
|
-
target[key] = source[key];
|
|
21020
|
-
}
|
|
21021
|
-
}
|
|
21034
|
+
return module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
21035
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
21036
|
+
var t = arguments[e];
|
|
21037
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
21022
21038
|
}
|
|
21023
|
-
return
|
|
21024
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21025
|
-
return _extends.apply(this, arguments);
|
|
21039
|
+
return n;
|
|
21040
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _extends.apply(null, arguments);
|
|
21026
21041
|
}
|
|
21027
21042
|
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21028
21043
|
});
|
|
@@ -21030,63 +21045,57 @@
|
|
|
21030
21045
|
var _extends$2 = unwrapExports(_extends_1);
|
|
21031
21046
|
|
|
21032
21047
|
var _typeof_1 = createCommonjsModule(function (module) {
|
|
21033
|
-
function _typeof(
|
|
21048
|
+
function _typeof(o) {
|
|
21034
21049
|
"@babel/helpers - typeof";
|
|
21035
21050
|
|
|
21036
|
-
return
|
|
21037
|
-
return typeof
|
|
21038
|
-
} : function (
|
|
21039
|
-
return
|
|
21040
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports
|
|
21051
|
+
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
21052
|
+
return typeof o;
|
|
21053
|
+
} : function (o) {
|
|
21054
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
21055
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
21041
21056
|
}
|
|
21042
21057
|
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21043
21058
|
});
|
|
21044
21059
|
|
|
21045
21060
|
unwrapExports(_typeof_1);
|
|
21046
21061
|
|
|
21047
|
-
var
|
|
21062
|
+
var toPrimitive_1 = createCommonjsModule(function (module) {
|
|
21048
21063
|
var _typeof = _typeof_1["default"];
|
|
21049
|
-
function
|
|
21050
|
-
if (
|
|
21051
|
-
var
|
|
21052
|
-
if (
|
|
21053
|
-
var
|
|
21054
|
-
if (
|
|
21064
|
+
function toPrimitive(t, r) {
|
|
21065
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
21066
|
+
var e = t[Symbol.toPrimitive];
|
|
21067
|
+
if (void 0 !== e) {
|
|
21068
|
+
var i = e.call(t, r || "default");
|
|
21069
|
+
if ("object" != _typeof(i)) return i;
|
|
21055
21070
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
21056
21071
|
}
|
|
21057
|
-
return (
|
|
21072
|
+
return ("string" === r ? String : Number)(t);
|
|
21058
21073
|
}
|
|
21059
|
-
module.exports =
|
|
21074
|
+
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21060
21075
|
});
|
|
21061
21076
|
|
|
21062
|
-
unwrapExports(
|
|
21077
|
+
unwrapExports(toPrimitive_1);
|
|
21063
21078
|
|
|
21064
|
-
var
|
|
21079
|
+
var toPropertyKey_1 = createCommonjsModule(function (module) {
|
|
21065
21080
|
var _typeof = _typeof_1["default"];
|
|
21066
21081
|
|
|
21067
|
-
function
|
|
21068
|
-
var
|
|
21069
|
-
return _typeof(
|
|
21082
|
+
function toPropertyKey(t) {
|
|
21083
|
+
var i = toPrimitive_1(t, "string");
|
|
21084
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
21070
21085
|
}
|
|
21071
|
-
module.exports =
|
|
21086
|
+
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21072
21087
|
});
|
|
21073
21088
|
|
|
21074
|
-
unwrapExports(
|
|
21089
|
+
unwrapExports(toPropertyKey_1);
|
|
21075
21090
|
|
|
21076
21091
|
var defineProperty = createCommonjsModule(function (module) {
|
|
21077
|
-
function _defineProperty(
|
|
21078
|
-
|
|
21079
|
-
|
|
21080
|
-
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
|
|
21084
|
-
writable: true
|
|
21085
|
-
});
|
|
21086
|
-
} else {
|
|
21087
|
-
obj[key] = value;
|
|
21088
|
-
}
|
|
21089
|
-
return obj;
|
|
21092
|
+
function _defineProperty(e, r, t) {
|
|
21093
|
+
return (r = toPropertyKey_1(r)) in e ? Object.defineProperty(e, r, {
|
|
21094
|
+
value: t,
|
|
21095
|
+
enumerable: !0,
|
|
21096
|
+
configurable: !0,
|
|
21097
|
+
writable: !0
|
|
21098
|
+
}) : e[r] = t, e;
|
|
21090
21099
|
}
|
|
21091
21100
|
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21092
21101
|
});
|
|
@@ -21094,17 +21103,14 @@
|
|
|
21094
21103
|
var _defineProperty$N = unwrapExports(defineProperty);
|
|
21095
21104
|
|
|
21096
21105
|
var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
|
|
21097
|
-
function _objectWithoutPropertiesLoose(
|
|
21098
|
-
if (
|
|
21099
|
-
var
|
|
21100
|
-
var
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
key = sourceKeys[i];
|
|
21104
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
21105
|
-
target[key] = source[key];
|
|
21106
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
21107
|
+
if (null == r) return {};
|
|
21108
|
+
var t = {};
|
|
21109
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
21110
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
21111
|
+
t[n] = r[n];
|
|
21106
21112
|
}
|
|
21107
|
-
return
|
|
21113
|
+
return t;
|
|
21108
21114
|
}
|
|
21109
21115
|
module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21110
21116
|
});
|
|
@@ -21112,20 +21118,16 @@
|
|
|
21112
21118
|
unwrapExports(objectWithoutPropertiesLoose);
|
|
21113
21119
|
|
|
21114
21120
|
var objectWithoutProperties = createCommonjsModule(function (module) {
|
|
21115
|
-
function _objectWithoutProperties(
|
|
21116
|
-
if (
|
|
21117
|
-
var
|
|
21118
|
-
|
|
21121
|
+
function _objectWithoutProperties(e, t) {
|
|
21122
|
+
if (null == e) return {};
|
|
21123
|
+
var o,
|
|
21124
|
+
r,
|
|
21125
|
+
i = objectWithoutPropertiesLoose(e, t);
|
|
21119
21126
|
if (Object.getOwnPropertySymbols) {
|
|
21120
|
-
var
|
|
21121
|
-
for (
|
|
21122
|
-
key = sourceSymbolKeys[i];
|
|
21123
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
21124
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
21125
|
-
target[key] = source[key];
|
|
21126
|
-
}
|
|
21127
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
21128
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
21127
21129
|
}
|
|
21128
|
-
return
|
|
21130
|
+
return i;
|
|
21129
21131
|
}
|
|
21130
21132
|
module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
21131
21133
|
});
|
|
@@ -23758,6 +23760,7 @@
|
|
|
23758
23760
|
exports.InfiniteHits = InfiniteHits$1;
|
|
23759
23761
|
exports.InstantSearch = InstantSearch$1;
|
|
23760
23762
|
exports.InstantSearchRSCContext = InstantSearchRSCContext;
|
|
23763
|
+
exports.InstantSearchSSRContext = InstantSearchSSRContext;
|
|
23761
23764
|
exports.InstantSearchSSRProvider = InstantSearchSSRProvider;
|
|
23762
23765
|
exports.InstantSearchServerContext = InstantSearchServerContext;
|
|
23763
23766
|
exports.LookingSimilar = LookingSimilar;
|