instantsearch.js 4.50.1 → 4.50.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.
@@ -134,10 +134,17 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
134
134
  getWidgetRenderState: function getWidgetRenderState(_ref5) {
135
135
  var results = _ref5.results,
136
136
  helper = _ref5.helper,
137
- state = _ref5.state,
137
+ parent = _ref5.parent,
138
+ existingState = _ref5.state,
138
139
  instantSearchInstance = _ref5.instantSearchInstance;
139
140
  var isFirstPage;
140
141
  var currentPageHits = [];
142
+ /**
143
+ * We bail out of optimistic UI here, as the cache is based on search
144
+ * parameters, and we don't want to invalidate the cache when the search
145
+ * is loading.
146
+ */
147
+ var state = parent.getPreviousState() || existingState;
141
148
  var cachedHits = cache.read({
142
149
  state: state
143
150
  }) || {};
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.50.1';
7
+ var _default = '4.50.2';
8
8
  exports.default = _default;
@@ -133,6 +133,9 @@ var index = function index(widgetParams) {
133
133
  derivedHelper.lastResults._state = helper.state;
134
134
  return derivedHelper.lastResults;
135
135
  },
136
+ getPreviousState: function getPreviousState() {
137
+ return lastValidSearchParameters;
138
+ },
136
139
  getScopedResults: function getScopedResults() {
137
140
  var widgetParent = this.getParent();
138
141
 
@@ -2055,6 +2055,7 @@ declare type IndexWidget = Omit<Widget<IndexWidgetDescription & {
2055
2055
  getIndexId(): string;
2056
2056
  getHelper(): AlgoliaSearchHelper | null;
2057
2057
  getResults(): SearchResults | null;
2058
+ getPreviousState(): SearchParameters | null;
2058
2059
  getScopedResults(): ScopedResult[];
2059
2060
  getParent(): IndexWidget | null;
2060
2061
  getWidgets(): Array<Widget | IndexWidget>;
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.50.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.50.2 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -7270,6 +7270,9 @@
7270
7270
  derivedHelper.lastResults._state = helper.state;
7271
7271
  return derivedHelper.lastResults;
7272
7272
  },
7273
+ getPreviousState: function getPreviousState() {
7274
+ return lastValidSearchParameters;
7275
+ },
7273
7276
  getScopedResults: function getScopedResults() {
7274
7277
  var widgetParent = this.getParent();
7275
7278
 
@@ -7617,7 +7620,7 @@
7617
7620
  instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
7618
7621
  }
7619
7622
 
7620
- var version$1 = '4.50.1';
7623
+ var version$1 = '4.50.2';
7621
7624
 
7622
7625
  var NAMESPACE = 'ais';
7623
7626
  var component = function component(componentName) {
@@ -10621,10 +10624,17 @@
10621
10624
  getWidgetRenderState: function getWidgetRenderState(_ref5) {
10622
10625
  var results = _ref5.results,
10623
10626
  helper = _ref5.helper,
10624
- state = _ref5.state,
10627
+ parent = _ref5.parent,
10628
+ existingState = _ref5.state,
10625
10629
  instantSearchInstance = _ref5.instantSearchInstance;
10626
10630
  var isFirstPage;
10627
10631
  var currentPageHits = [];
10632
+ /**
10633
+ * We bail out of optimistic UI here, as the cache is based on search
10634
+ * parameters, and we don't want to invalidate the cache when the search
10635
+ * is loading.
10636
+ */
10637
+ var state = parent.getPreviousState() || existingState;
10628
10638
  var cachedHits = cache.read({
10629
10639
  state: state
10630
10640
  }) || {};