react-instantsearch 7.16.1 → 7.16.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.
@@ -7,7 +7,7 @@
7
7
 
8
8
  var React__default = 'default' in React ? React['default'] : React;
9
9
 
10
- var version = '7.16.1';
10
+ var version = '7.16.2';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -13468,7 +13468,7 @@
13468
13468
  };
13469
13469
  }
13470
13470
 
13471
- var version$3 = '4.79.1';
13471
+ var version$3 = '4.79.2';
13472
13472
 
13473
13473
  function _typeof$q(o) {
13474
13474
  "@babel/helpers - typeof";
@@ -16796,22 +16796,20 @@
16796
16796
  return Math.max.apply(Math, [page].concat(_toConsumableArray$6(pages)));
16797
16797
  }
16798
16798
  };
16799
- var getShowPrevious = function getShowPrevious(helper) {
16799
+ var getShowPrevious = function getShowPrevious(helper, getCachedHits) {
16800
16800
  return function () {
16801
+ var cachedHits = getCachedHits();
16801
16802
  // Using the helper's `overrideStateWithoutTriggeringChangeEvent` method
16802
16803
  // avoid updating the browser URL when the user displays the previous page.
16803
16804
  helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread$v(_objectSpread$v({}, helper.state), {}, {
16804
- page: getFirstReceivedPage(helper.state, cache.read({
16805
- state: normalizeState(helper.state)
16806
- }) || {}) - 1
16805
+ page: getFirstReceivedPage(helper.state, cachedHits) - 1
16807
16806
  })).searchWithoutTriggeringOnStateChange();
16808
16807
  };
16809
16808
  };
16810
- var getShowMore = function getShowMore(helper) {
16809
+ var getShowMore = function getShowMore(helper, getCachedHits) {
16811
16810
  return function () {
16812
- helper.setPage(getLastReceivedPage(helper.state, cache.read({
16813
- state: normalizeState(helper.state)
16814
- }) || {}) + 1).search();
16811
+ var cachedHits = getCachedHits();
16812
+ helper.setPage(getLastReceivedPage(helper.state, cachedHits) + 1).search();
16815
16813
  };
16816
16814
  };
16817
16815
  return {
@@ -16843,6 +16841,12 @@
16843
16841
  parent = _ref6.parent,
16844
16842
  existingState = _ref6.state,
16845
16843
  instantSearchInstance = _ref6.instantSearchInstance;
16844
+ var getCacheHits = function getCacheHits() {
16845
+ var state = parent.getPreviousState() || existingState;
16846
+ return cache.read({
16847
+ state: normalizeState(state)
16848
+ }) || {};
16849
+ };
16846
16850
  var isFirstPage;
16847
16851
  var currentPageHits = [];
16848
16852
  /**
@@ -16851,13 +16855,15 @@
16851
16855
  * is loading.
16852
16856
  */
16853
16857
  var state = parent.getPreviousState() || existingState;
16854
- var cachedHits = cache.read({
16855
- state: normalizeState(state)
16856
- }) || {};
16858
+ var cachedHits = getCacheHits();
16857
16859
  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];
16858
16860
  if (!showPrevious) {
16859
- showPrevious = getShowPrevious(helper);
16860
- showMore = getShowMore(helper);
16861
+ showPrevious = function showPrevious() {
16862
+ return getShowPrevious(helper, getCacheHits)();
16863
+ };
16864
+ showMore = function showMore() {
16865
+ return getShowMore(helper, getCacheHits)();
16866
+ };
16861
16867
  }
16862
16868
  if (!sendEvent) {
16863
16869
  sendEvent = createSendEventForHits({