algolia-experiences 1.5.13 → 1.5.14

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.
@@ -13069,7 +13069,7 @@
13069
13069
  };
13070
13070
  }
13071
13071
 
13072
- var version$1 = '4.79.1';
13072
+ var version$1 = '4.79.2';
13073
13073
 
13074
13074
  function _typeof$j(o) {
13075
13075
  "@babel/helpers - typeof";
@@ -21060,22 +21060,20 @@
21060
21060
  return Math.max.apply(Math, [page].concat(_toConsumableArray$8(pages)));
21061
21061
  }
21062
21062
  };
21063
- var getShowPrevious = function getShowPrevious(helper) {
21063
+ var getShowPrevious = function getShowPrevious(helper, getCachedHits) {
21064
21064
  return function () {
21065
+ var cachedHits = getCachedHits();
21065
21066
  // Using the helper's `overrideStateWithoutTriggeringChangeEvent` method
21066
21067
  // avoid updating the browser URL when the user displays the previous page.
21067
21068
  helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread$G(_objectSpread$G({}, helper.state), {}, {
21068
- page: getFirstReceivedPage(helper.state, cache.read({
21069
- state: normalizeState(helper.state)
21070
- }) || {}) - 1
21069
+ page: getFirstReceivedPage(helper.state, cachedHits) - 1
21071
21070
  })).searchWithoutTriggeringOnStateChange();
21072
21071
  };
21073
21072
  };
21074
- var getShowMore = function getShowMore(helper) {
21073
+ var getShowMore = function getShowMore(helper, getCachedHits) {
21075
21074
  return function () {
21076
- helper.setPage(getLastReceivedPage(helper.state, cache.read({
21077
- state: normalizeState(helper.state)
21078
- }) || {}) + 1).search();
21075
+ var cachedHits = getCachedHits();
21076
+ helper.setPage(getLastReceivedPage(helper.state, cachedHits) + 1).search();
21079
21077
  };
21080
21078
  };
21081
21079
  return {
@@ -21107,6 +21105,12 @@
21107
21105
  parent = _ref6.parent,
21108
21106
  existingState = _ref6.state,
21109
21107
  instantSearchInstance = _ref6.instantSearchInstance;
21108
+ var getCacheHits = function getCacheHits() {
21109
+ var state = parent.getPreviousState() || existingState;
21110
+ return cache.read({
21111
+ state: normalizeState(state)
21112
+ }) || {};
21113
+ };
21110
21114
  var isFirstPage;
21111
21115
  var currentPageHits = [];
21112
21116
  /**
@@ -21115,13 +21119,15 @@
21115
21119
  * is loading.
21116
21120
  */
21117
21121
  var state = parent.getPreviousState() || existingState;
21118
- var cachedHits = cache.read({
21119
- state: normalizeState(state)
21120
- }) || {};
21122
+ var cachedHits = getCacheHits();
21121
21123
  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];
21122
21124
  if (!showPrevious) {
21123
- showPrevious = getShowPrevious(helper);
21124
- showMore = getShowMore(helper);
21125
+ showPrevious = function showPrevious() {
21126
+ return getShowPrevious(helper, getCacheHits)();
21127
+ };
21128
+ showMore = function showMore() {
21129
+ return getShowMore(helper, getCacheHits)();
21130
+ };
21125
21131
  }
21126
21132
  if (!sendEvent) {
21127
21133
  sendEvent = createSendEventForHits({