react-native-onyx 1.0.51 → 1.0.53

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/lib/Onyx.js CHANGED
@@ -1129,14 +1129,25 @@ 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
- throw new Error(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);
1138
+ if (process.env.NODE_ENV === 'development') {
1139
+ throw new Error(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);
1140
+ }
1141
+
1142
+ hasCollectionKeyCheckFailed = true;
1143
+ Logger.logAlert(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`);
1138
1144
  });
1139
1145
 
1146
+ // Gracefully handle bad mergeCollection updates so it doesn't block the merge queue
1147
+ if (hasCollectionKeyCheckFailed) {
1148
+ return Promise.resolve();
1149
+ }
1150
+
1140
1151
  return getAllKeys()
1141
1152
  .then((persistedKeys) => {
1142
1153
  // Split to keys that exist in storage and keys that don't
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",