instantsearch.js 4.50.1 → 4.50.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.
@@ -128,10 +128,17 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
128
128
  getWidgetRenderState: function getWidgetRenderState(_ref5) {
129
129
  var results = _ref5.results,
130
130
  helper = _ref5.helper,
131
- state = _ref5.state,
131
+ parent = _ref5.parent,
132
+ existingState = _ref5.state,
132
133
  instantSearchInstance = _ref5.instantSearchInstance;
133
134
  var isFirstPage;
134
135
  var currentPageHits = [];
136
+ /**
137
+ * We bail out of optimistic UI here, as the cache is based on search
138
+ * parameters, and we don't want to invalidate the cache when the search
139
+ * is loading.
140
+ */
141
+ var state = parent.getPreviousState() || existingState;
135
142
  var cachedHits = cache.read({
136
143
  state: state
137
144
  }) || {};
@@ -1,2 +1,2 @@
1
- declare const _default: "4.50.1";
1
+ declare const _default: "4.50.3";
2
2
  export default _default;
package/es/lib/version.js CHANGED
@@ -1 +1 @@
1
- export default '4.50.1';
1
+ export default '4.50.3';
@@ -1 +1 @@
1
- export type { default as InstantSearch, InstantSearchOptions, } from '../lib/InstantSearch';
1
+ export type { default as InstantSearch, InstantSearchOptions, InstantSearchStatus, } from '../lib/InstantSearch';
@@ -23,6 +23,7 @@ export type IndexWidget = Omit<Widget<IndexWidgetDescription & {
23
23
  getIndexId(): string;
24
24
  getHelper(): Helper | null;
25
25
  getResults(): SearchResults | null;
26
+ getPreviousState(): SearchParameters | null;
26
27
  getScopedResults(): ScopedResult[];
27
28
  getParent(): IndexWidget | null;
28
29
  getWidgets(): Array<Widget | IndexWidget>;
@@ -126,6 +126,9 @@ var index = function index(widgetParams) {
126
126
  derivedHelper.lastResults._state = helper.state;
127
127
  return derivedHelper.lastResults;
128
128
  },
129
+ getPreviousState: function getPreviousState() {
130
+ return lastValidSearchParameters;
131
+ },
129
132
  getScopedResults: function getScopedResults() {
130
133
  var widgetParent = this.getParent();
131
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.50.1",
3
+ "version": "4.50.3",
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",
@@ -55,9 +55,9 @@
55
55
  "version": "./scripts/version/update-version.js"
56
56
  },
57
57
  "devDependencies": {
58
- "@instantsearch/mocks": "1.2.0",
59
- "@instantsearch/tests": "1.2.0",
60
- "@instantsearch/testutils": "1.0.5",
58
+ "@instantsearch/mocks": "1.4.0",
59
+ "@instantsearch/tests": "1.4.0",
60
+ "@instantsearch/testutils": "1.0.7",
61
61
  "@storybook/html": "5.3.9",
62
62
  "@types/scriptjs": "0.0.2",
63
63
  "algoliasearch": "4.14.3",
@@ -65,5 +65,5 @@
65
65
  "scriptjs": "2.5.9",
66
66
  "webpack": "4.41.5"
67
67
  },
68
- "gitHead": "9c696ab3244d701c05d314bb765f086a50ff481b"
68
+ "gitHead": "cbcf03650d0bda8dd4f57f50e6c7e890e38c352a"
69
69
  }