instantsearch.js 4.79.0 → 4.79.2

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.
@@ -92,22 +92,20 @@ export default (function connectInfiniteHits(renderFn) {
92
92
  return Math.max.apply(Math, [page].concat(_toConsumableArray(pages)));
93
93
  }
94
94
  };
95
- var getShowPrevious = function getShowPrevious(helper) {
95
+ var getShowPrevious = function getShowPrevious(helper, getCachedHits) {
96
96
  return function () {
97
+ var cachedHits = getCachedHits();
97
98
  // Using the helper's `overrideStateWithoutTriggeringChangeEvent` method
98
99
  // avoid updating the browser URL when the user displays the previous page.
99
100
  helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
100
- page: getFirstReceivedPage(helper.state, cache.read({
101
- state: normalizeState(helper.state)
102
- }) || {}) - 1
101
+ page: getFirstReceivedPage(helper.state, cachedHits) - 1
103
102
  })).searchWithoutTriggeringOnStateChange();
104
103
  };
105
104
  };
106
- var getShowMore = function getShowMore(helper) {
105
+ var getShowMore = function getShowMore(helper, getCachedHits) {
107
106
  return function () {
108
- helper.setPage(getLastReceivedPage(helper.state, cache.read({
109
- state: normalizeState(helper.state)
110
- }) || {}) + 1).search();
107
+ var cachedHits = getCachedHits();
108
+ helper.setPage(getLastReceivedPage(helper.state, cachedHits) + 1).search();
111
109
  };
112
110
  };
113
111
  return {
@@ -139,6 +137,12 @@ export default (function connectInfiniteHits(renderFn) {
139
137
  parent = _ref6.parent,
140
138
  existingState = _ref6.state,
141
139
  instantSearchInstance = _ref6.instantSearchInstance;
140
+ var getCacheHits = function getCacheHits() {
141
+ var state = parent.getPreviousState() || existingState;
142
+ return cache.read({
143
+ state: normalizeState(state)
144
+ }) || {};
145
+ };
142
146
  var isFirstPage;
143
147
  var currentPageHits = [];
144
148
  /**
@@ -147,13 +151,15 @@ export default (function connectInfiniteHits(renderFn) {
147
151
  * is loading.
148
152
  */
149
153
  var state = parent.getPreviousState() || existingState;
150
- var cachedHits = cache.read({
151
- state: normalizeState(state)
152
- }) || {};
154
+ var cachedHits = getCacheHits();
153
155
  var banner = results === null || results === void 0 ? void 0 : (_results$renderingCon = results.renderingContent) === null || _results$renderingCon === void 0 ? void 0 : (_results$renderingCon2 = _results$renderingCon.widgets) === null || _results$renderingCon2 === void 0 ? void 0 : (_results$renderingCon3 = _results$renderingCon2.banners) === null || _results$renderingCon3 === void 0 ? void 0 : _results$renderingCon3[0];
154
156
  if (!showPrevious) {
155
- showPrevious = getShowPrevious(helper);
156
- showMore = getShowMore(helper);
157
+ showPrevious = function showPrevious() {
158
+ return getShowPrevious(helper, getCacheHits)();
159
+ };
160
+ showMore = function showMore() {
161
+ return getShowMore(helper, getCacheHits)();
162
+ };
157
163
  }
158
164
  if (!sendEvent) {
159
165
  sendEvent = createSendEventForHits({
@@ -1,2 +1,2 @@
1
- declare const _default: "4.79.0";
1
+ declare const _default: "4.79.2";
2
2
  export default _default;
package/es/lib/version.js CHANGED
@@ -1 +1 @@
1
- export default '4.79.0';
1
+ export default '4.79.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.79.0",
3
+ "version": "4.79.2",
4
4
  "description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
5
5
  "homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
6
6
  "types": "es/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "algoliasearch-helper": "3.26.0",
35
35
  "hogan.js": "^3.0.2",
36
36
  "htm": "^3.0.0",
37
- "instantsearch-ui-components": "0.11.1",
37
+ "instantsearch-ui-components": "0.11.2",
38
38
  "preact": "^10.10.0",
39
39
  "qs": "^6.5.1 < 6.10",
40
40
  "search-insights": "^2.17.2"
@@ -56,9 +56,9 @@
56
56
  "watch:es": "yarn --silent build:es:base --watch"
57
57
  },
58
58
  "devDependencies": {
59
- "@instantsearch/mocks": "1.75.0",
60
- "@instantsearch/tests": "1.75.0",
61
- "@instantsearch/testutils": "1.64.0",
59
+ "@instantsearch/mocks": "1.77.0",
60
+ "@instantsearch/tests": "1.77.0",
61
+ "@instantsearch/testutils": "1.66.0",
62
62
  "@storybook/html": "5.3.9",
63
63
  "@types/scriptjs": "0.0.2",
64
64
  "algoliasearch": "5.1.1",
@@ -66,5 +66,5 @@
66
66
  "scriptjs": "2.5.9",
67
67
  "webpack": "4.47.0"
68
68
  },
69
- "gitHead": "eeb0a611e331ae0905a641d167ebac38d2fe1735"
69
+ "gitHead": "4170d7c9a3ee4adc729330a7cba90527aca2dbc5"
70
70
  }