react-instantsearch-core
Advanced tools
Comparing version 6.10.1 to 6.10.2
@@ -93,11 +93,6 @@ "use strict"; | ||
}); | ||
this._prevState = this._prevState || {}; | ||
this._cache = props.cache ? props.cache : this._cache || getInMemoryCache(); | ||
var cachedHits = this._cache.read({ | ||
state: searchState | ||
}) || {}; | ||
if (!results) { | ||
return { | ||
hits: extractHitsFromCachedHits(cachedHits), | ||
hits: [], | ||
hasPrevious: false, | ||
@@ -115,25 +110,15 @@ hasMore: false, | ||
nbPages = results.nbPages, | ||
_results$_state = results._state; | ||
_results$_state = _results$_state === void 0 ? {} : _results$_state; | ||
var p = _results$_state.page, | ||
currentState = (0, _objectWithoutProperties2.default)(_results$_state, ["page"]); | ||
state = results._state; | ||
this._cache = props.cache ? props.cache : this._cache || getInMemoryCache(); | ||
var cachedHits = this._cache.read({ | ||
state: state | ||
}) || {}; | ||
var hitsWithPositions = (0, _utils.addAbsolutePositions)(hits, hitsPerPage, page); | ||
var hitsWithPositionsAndQueryID = (0, _utils.addQueryID)(hitsWithPositions, results.queryID); | ||
cachedHits[page] = hitsWithPositionsAndQueryID; | ||
if (!(0, _reactFastCompare.default)(currentState, this._prevState)) { | ||
cachedHits = this._cache.read({ | ||
state: searchState | ||
}) || {}; | ||
} | ||
if (cachedHits[page] === undefined) { | ||
cachedHits[page] = hitsWithPositionsAndQueryID; | ||
this._cache.write({ | ||
state: searchState, | ||
hits: cachedHits | ||
}); | ||
} | ||
this._prevState = currentState; | ||
this._cache.write({ | ||
state: state, | ||
hits: cachedHits | ||
}); | ||
/* | ||
@@ -144,2 +129,3 @@ Math.min() and Math.max() returns Infinity or -Infinity when no argument is given. | ||
var firstReceivedPage = Math.min.apply(Math, (0, _toConsumableArray2.default)(Object.keys(cachedHits).map(Number))); | ||
@@ -176,19 +162,2 @@ var lastReceivedPage = Math.max.apply(Math, (0, _toConsumableArray2.default)(Object.keys(cachedHits).map(Number))); | ||
refine: function refine(props, searchState, event, index) { | ||
this._cache = props.cache ? props.cache : this._cache || getInMemoryCache(); | ||
var cachedHits = this._cache.read({ | ||
state: searchState | ||
}) || {}; | ||
var pages = Object.keys(cachedHits).map(Number); | ||
var lastReceivedPage = pages.length === 0 ? undefined : Math.max.apply(Math, (0, _toConsumableArray2.default)(pages)); // If there is no key in `this._cachedHits`, | ||
// then `lastReceivedPage` should be `undefined`. | ||
if (index === undefined && lastReceivedPage !== undefined) { | ||
index = lastReceivedPage + 1; | ||
} else if (index === undefined) { | ||
index = getCurrentRefinement(props, searchState, { | ||
ais: props.contextValue, | ||
multiIndexContext: props.indexContextValue | ||
}); | ||
} | ||
var id = getId(); | ||
@@ -195,0 +164,0 @@ var nextValue = (0, _defineProperty2.default)({}, id, index + 1); |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _default = '6.10.1'; | ||
var _default = '6.10.2'; | ||
exports.default = _default; |
@@ -78,11 +78,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
}); | ||
this._prevState = this._prevState || {}; | ||
this._cache = props.cache ? props.cache : this._cache || getInMemoryCache(); | ||
var cachedHits = this._cache.read({ | ||
state: searchState | ||
}) || {}; | ||
if (!results) { | ||
return { | ||
hits: extractHitsFromCachedHits(cachedHits), | ||
hits: [], | ||
hasPrevious: false, | ||
@@ -100,27 +95,15 @@ hasMore: false, | ||
nbPages = results.nbPages, | ||
_results$_state = results._state; | ||
_results$_state = _results$_state === void 0 ? {} : _results$_state; | ||
var p = _results$_state.page, | ||
currentState = _objectWithoutProperties(_results$_state, ["page"]); | ||
state = results._state; | ||
this._cache = props.cache ? props.cache : this._cache || getInMemoryCache(); | ||
var cachedHits = this._cache.read({ | ||
state: state | ||
}) || {}; | ||
var hitsWithPositions = addAbsolutePositions(hits, hitsPerPage, page); | ||
var hitsWithPositionsAndQueryID = addQueryID(hitsWithPositions, results.queryID); | ||
cachedHits[page] = hitsWithPositionsAndQueryID; | ||
if (!isEqual(currentState, this._prevState)) { | ||
cachedHits = this._cache.read({ | ||
state: searchState | ||
}) || {}; | ||
} | ||
if (cachedHits[page] === undefined) { | ||
cachedHits[page] = hitsWithPositionsAndQueryID; | ||
this._cache.write({ | ||
state: searchState, | ||
hits: cachedHits | ||
}); | ||
} | ||
this._prevState = currentState; | ||
this._cache.write({ | ||
state: state, | ||
hits: cachedHits | ||
}); | ||
/* | ||
@@ -131,2 +114,3 @@ Math.min() and Math.max() returns Infinity or -Infinity when no argument is given. | ||
var firstReceivedPage = Math.min.apply(Math, _toConsumableArray(Object.keys(cachedHits).map(Number))); | ||
@@ -163,19 +147,2 @@ var lastReceivedPage = Math.max.apply(Math, _toConsumableArray(Object.keys(cachedHits).map(Number))); | ||
refine: function refine(props, searchState, event, index) { | ||
this._cache = props.cache ? props.cache : this._cache || getInMemoryCache(); | ||
var cachedHits = this._cache.read({ | ||
state: searchState | ||
}) || {}; | ||
var pages = Object.keys(cachedHits).map(Number); | ||
var lastReceivedPage = pages.length === 0 ? undefined : Math.max.apply(Math, _toConsumableArray(pages)); // If there is no key in `this._cachedHits`, | ||
// then `lastReceivedPage` should be `undefined`. | ||
if (index === undefined && lastReceivedPage !== undefined) { | ||
index = lastReceivedPage + 1; | ||
} else if (index === undefined) { | ||
index = getCurrentRefinement(props, searchState, { | ||
ais: props.contextValue, | ||
multiIndexContext: props.indexContextValue | ||
}); | ||
} | ||
var id = getId(); | ||
@@ -182,0 +149,0 @@ |
@@ -1,1 +0,1 @@ | ||
export default '6.10.1'; | ||
export default '6.10.2'; |
{ | ||
"name": "react-instantsearch-core", | ||
"version": "6.10.1", | ||
"version": "6.10.2", | ||
"description": "⚡ Lightning-fast search for React, by Algolia", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2087501
20104