react-instantsearch-core 7.12.2 → 7.12.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/useIndex.js +1 -1
- package/dist/cjs/lib/useIndexContext.js +1 -1
- package/dist/cjs/lib/useInstantSearchContext.js +1 -1
- package/dist/cjs/lib/useStableValue.js +1 -1
- package/dist/cjs/server/getServerState.js +4 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/lib/useIndex.js +1 -1
- package/dist/es/lib/useIndexContext.js +1 -1
- package/dist/es/lib/useInstantSearchContext.js +1 -1
- package/dist/es/server/getServerState.d.ts +1 -1
- package/dist/es/server/getServerState.js +2 -1
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +9 -4
- 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 +3 -3
package/dist/cjs/lib/useIndex.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useIndex = useIndex;
|
|
7
7
|
var _index = _interopRequireDefault(require("instantsearch.js/cjs/widgets/index/index"));
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var _useIndexContext = require("../lib/useIndexContext");
|
|
10
9
|
var _useForceUpdate = require("./useForceUpdate");
|
|
10
|
+
var _useIndexContext = require("./useIndexContext");
|
|
11
11
|
var _useInstantSearchServerContext = require("./useInstantSearchServerContext");
|
|
12
12
|
var _useInstantSearchSSRContext = require("./useInstantSearchSSRContext");
|
|
13
13
|
var _useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect");
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useIndexContext = useIndexContext;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _invariant = require("../lib/invariant");
|
|
9
8
|
var _IndexContext = require("./IndexContext");
|
|
9
|
+
var _invariant = require("./invariant");
|
|
10
10
|
function useIndexContext() {
|
|
11
11
|
var context = (0, _react.useContext)(_IndexContext.IndexContext);
|
|
12
12
|
(0, _invariant.invariant)(context !== null, 'The <Index> component must be used within <InstantSearch>.');
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useInstantSearchContext = useInstantSearchContext;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _invariant = require("../lib/invariant");
|
|
9
8
|
var _InstantSearchContext = require("./InstantSearchContext");
|
|
9
|
+
var _invariant = require("./invariant");
|
|
10
10
|
function useInstantSearchContext() {
|
|
11
11
|
var search = (0, _react.useContext)(_InstantSearchContext.InstantSearchContext);
|
|
12
12
|
(0, _invariant.invariant)(search !== null, 'Hooks must be used inside the <InstantSearch> component.\n\n' + 'They are not compatible with the `react-instantsearch-core@6.x` and `react-instantsearch-dom` packages, so make sure to use the <InstantSearch> component from `react-instantsearch-core@7.x`.');
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useStableValue = useStableValue;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _dequal = require("
|
|
8
|
+
var _dequal = require("./dequal");
|
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -7,7 +7,8 @@ exports.getServerState = getServerState;
|
|
|
7
7
|
var _server = require("instantsearch.js/cjs/lib/server");
|
|
8
8
|
var _utils = require("instantsearch.js/cjs/lib/utils");
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var
|
|
10
|
+
var _InstantSearchServerContext = require("../components/InstantSearchServerContext");
|
|
11
|
+
var _InstantSearchSSRProvider = require("../components/InstantSearchSSRProvider");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
/**
|
|
13
14
|
* Returns the InstantSearch server state from a component.
|
|
@@ -48,7 +49,7 @@ function getServerState(children, _ref) {
|
|
|
48
49
|
if (shouldRefetch) {
|
|
49
50
|
(0, _utils.resetWidgetId)();
|
|
50
51
|
return execute({
|
|
51
|
-
children: /*#__PURE__*/_react.default.createElement(
|
|
52
|
+
children: /*#__PURE__*/_react.default.createElement(_InstantSearchSSRProvider.InstantSearchSSRProvider, serverState, children),
|
|
52
53
|
renderToString: renderToString,
|
|
53
54
|
searchRef: searchRef,
|
|
54
55
|
notifyServer: createNotifyServer(),
|
|
@@ -65,7 +66,7 @@ function execute(_ref3) {
|
|
|
65
66
|
searchRef = _ref3.searchRef,
|
|
66
67
|
skipRecommend = _ref3.skipRecommend;
|
|
67
68
|
return Promise.resolve().then(function () {
|
|
68
|
-
renderToString( /*#__PURE__*/_react.default.createElement(
|
|
69
|
+
renderToString( /*#__PURE__*/_react.default.createElement(_InstantSearchServerContext.InstantSearchServerContext.Provider, {
|
|
69
70
|
value: {
|
|
70
71
|
notifyServer: notifyServer
|
|
71
72
|
}
|
package/dist/cjs/version.js
CHANGED
package/dist/es/lib/useIndex.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import index from "instantsearch.js/es/widgets/index/index.js";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { useIndexContext } from "./useIndexContext.js";
|
|
4
3
|
import { useForceUpdate } from "./useForceUpdate.js";
|
|
4
|
+
import { useIndexContext } from "./useIndexContext.js";
|
|
5
5
|
import { useInstantSearchServerContext } from "./useInstantSearchServerContext.js";
|
|
6
6
|
import { useInstantSearchSSRContext } from "./useInstantSearchSSRContext.js";
|
|
7
7
|
import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { invariant } from "./invariant.js";
|
|
3
2
|
import { IndexContext } from "./IndexContext.js";
|
|
3
|
+
import { invariant } from "./invariant.js";
|
|
4
4
|
export function useIndexContext() {
|
|
5
5
|
var context = useContext(IndexContext);
|
|
6
6
|
invariant(context !== null, 'The <Index> component must be used within <InstantSearch>.');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { invariant } from "./invariant.js";
|
|
3
2
|
import { InstantSearchContext } from "./InstantSearchContext.js";
|
|
3
|
+
import { invariant } from "./invariant.js";
|
|
4
4
|
export function useInstantSearchContext() {
|
|
5
5
|
var search = useContext(InstantSearchContext);
|
|
6
6
|
invariant(search !== null, 'Hooks must be used inside the <InstantSearch> component.\n\n' + 'They are not compatible with the `react-instantsearch-core@6.x` and `react-instantsearch-dom` packages, so make sure to use the <InstantSearch> component from `react-instantsearch-core@7.x`.');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InstantSearchServerState } from '
|
|
1
|
+
import type { InstantSearchServerState } from '../components/InstantSearchSSRProvider';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
export type RenderToString = (element: JSX.Element) => unknown;
|
|
4
4
|
export type GetServerStateOptions = {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getInitialResults, waitForResults } from "instantsearch.js/es/lib/server.js";
|
|
2
2
|
import { walkIndex, resetWidgetId } from "instantsearch.js/es/lib/utils/index.js";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { InstantSearchServerContext
|
|
4
|
+
import { InstantSearchServerContext } from "../components/InstantSearchServerContext.js";
|
|
5
|
+
import { InstantSearchSSRProvider } from "../components/InstantSearchSSRProvider.js";
|
|
5
6
|
/**
|
|
6
7
|
* Returns the InstantSearch server state from a component.
|
|
7
8
|
*/
|
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.12.
|
|
1
|
+
declare const _default: "7.12.3";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '7.12.
|
|
1
|
+
export default '7.12.3';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var React__default = 'default' in React ? React['default'] : React;
|
|
9
9
|
|
|
10
|
-
var version = '7.12.
|
|
10
|
+
var version = '7.12.3';
|
|
11
11
|
|
|
12
12
|
function _iterableToArrayLimit(arr, i) {
|
|
13
13
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
@@ -9027,6 +9027,8 @@
|
|
|
9027
9027
|
};
|
|
9028
9028
|
}
|
|
9029
9029
|
|
|
9030
|
+
var IndexContext = /*#__PURE__*/React.createContext(null);
|
|
9031
|
+
|
|
9030
9032
|
/**
|
|
9031
9033
|
* Throws an error if the condition is not met.
|
|
9032
9034
|
*
|
|
@@ -9044,8 +9046,6 @@
|
|
|
9044
9046
|
}
|
|
9045
9047
|
}
|
|
9046
9048
|
|
|
9047
|
-
var IndexContext = /*#__PURE__*/React.createContext(null);
|
|
9048
|
-
|
|
9049
9049
|
function useIndexContext() {
|
|
9050
9050
|
var context = React.useContext(IndexContext);
|
|
9051
9051
|
invariant(context !== null);
|
|
@@ -12083,6 +12083,11 @@
|
|
|
12083
12083
|
var _this5 = this;
|
|
12084
12084
|
return safelyRunOnBrowser(function (_ref6) {
|
|
12085
12085
|
var window = _ref6.window;
|
|
12086
|
+
// When disposed and the cleanUrlOnDispose is set to false, we do not want to write the URL.
|
|
12087
|
+
if (_this5.isDisposed && !_this5._cleanUrlOnDispose) {
|
|
12088
|
+
return false;
|
|
12089
|
+
}
|
|
12090
|
+
|
|
12086
12091
|
// We do want to `pushState` if:
|
|
12087
12092
|
// - the router is not disposed, IS.js needs to update the URL
|
|
12088
12093
|
// OR
|
|
@@ -18070,7 +18075,7 @@
|
|
|
18070
18075
|
};
|
|
18071
18076
|
}
|
|
18072
18077
|
|
|
18073
|
-
var version$2 = '4.73.
|
|
18078
|
+
var version$2 = '4.73.3';
|
|
18074
18079
|
|
|
18075
18080
|
function _typeof$I(obj) {
|
|
18076
18081
|
"@babel/helpers - typeof";
|