react-native-onyx 1.0.25 → 1.0.26
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.
- package/dist/web.development.js +9 -0
- package/dist/web.development.js.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/Onyx.js +5 -0
- package/lib/OnyxCache.js +4 -0
- package/package.json +1 -1
package/dist/web.development.js
CHANGED
|
@@ -1537,6 +1537,11 @@ function clear() {
|
|
|
1537
1537
|
* @returns {Promise}
|
|
1538
1538
|
*/
|
|
1539
1539
|
function mergeCollection(collectionKey, collection) {
|
|
1540
|
+
if (!_underscore.default.isObject(collection) || _underscore.default.isArray(collection) || _underscore.default.isEmpty(collection)) {
|
|
1541
|
+
Logger.logInfo('mergeCollection() called with invalid or empty value. Skipping this update.');
|
|
1542
|
+
return Promise.resolve();
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1540
1545
|
// Confirm all the collection keys belong to the same parent
|
|
1541
1546
|
_underscore.default.each(collection, function (_data, dataKey) {
|
|
1542
1547
|
if (isKeyMatch(collectionKey, dataKey)) {
|
|
@@ -1868,6 +1873,10 @@ OnyxCache = /*#__PURE__*/function () {
|
|
|
1868
1873
|
* @param {Record<string, *>} data - a map of (cache) key - values
|
|
1869
1874
|
*/ }, { key: "merge", value: function merge(
|
|
1870
1875
|
data) {var _this = this;
|
|
1876
|
+
if (!_underscore.default.isObject(data) || _underscore.default.isArray(data)) {
|
|
1877
|
+
throw new Error('data passed to cache.merge() must be an Object of onyx key/value pairs');
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1871
1880
|
// lodash adds a small overhead so we don't use it here
|
|
1872
1881
|
// eslint-disable-next-line prefer-object-spread, rulesdir/prefer-underscore-method
|
|
1873
1882
|
this.storageMap = (0, _extends2.default)({}, (0, _fastMerge.default)(this.storageMap, data));
|