react-native-onyx 1.0.50 → 1.0.52
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 +11 -2
- 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 +11 -2
- package/package.json +1 -1
package/lib/Onyx.js
CHANGED
|
@@ -1129,14 +1129,20 @@ function mergeCollection(collectionKey, collection) {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
|
|
1131
1131
|
// Confirm all the collection keys belong to the same parent
|
|
1132
|
+
let hasCollectionKeyCheckFailed = false;
|
|
1132
1133
|
_.each(collection, (_data, dataKey) => {
|
|
1133
1134
|
if (isKeyMatch(collectionKey, dataKey)) {
|
|
1134
1135
|
return;
|
|
1135
1136
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1137
|
+
hasCollectionKeyCheckFailed = true;
|
|
1138
|
+
Logger.logAlert(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);
|
|
1138
1139
|
});
|
|
1139
1140
|
|
|
1141
|
+
// Gracefully handle bad mergeCollection updates so it doesn't block the merge queue
|
|
1142
|
+
if (hasCollectionKeyCheckFailed) {
|
|
1143
|
+
return Promise.resolve();
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1140
1146
|
return getAllKeys()
|
|
1141
1147
|
.then((persistedKeys) => {
|
|
1142
1148
|
// Split to keys that exist in storage and keys that don't
|
|
@@ -1222,6 +1228,9 @@ function update(data) {
|
|
|
1222
1228
|
*/
|
|
1223
1229
|
function setMemoryOnlyKeys(keyList) {
|
|
1224
1230
|
Storage.setMemoryOnlyKeys(keyList);
|
|
1231
|
+
|
|
1232
|
+
// When in memory only mode for certain keys we do not want to ever drop items from the cache as the user will have no way to recover them again via storage.
|
|
1233
|
+
cache.setRecentKeysLimit(Infinity);
|
|
1225
1234
|
}
|
|
1226
1235
|
|
|
1227
1236
|
/**
|