diff --git a/lib/Onyx.js b/lib/Onyx.js index a2f14c299..dbfb4899c 100644 --- a/lib/Onyx.js +++ b/lib/Onyx.js @@ -1129,14 +1129,20 @@ function mergeCollection(collectionKey, collection) { } // Confirm all the collection keys belong to the same parent + let hasCollectionKeyCheckFailed = false; _.each(collection, (_data, dataKey) => { if (isKeyMatch(collectionKey, dataKey)) { return; } - - throw new Error(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`); + hasCollectionKeyCheckFailed = true; + Logger.logError(`Provided collection doesn't have all its data belonging to the same parent. CollectionKey: ${collectionKey}, DataKey: ${dataKey}`); }); + // Gracefully handle bad mergeCollection updates so it doesn't block the merge queue + if (hasCollectionKeyCheckFailed) { + return Promise.resolve(); + } + return getAllKeys() .then((persistedKeys) => { // Split to keys that exist in storage and keys that don't