From 92884d9cbe7933d70c5e271d6c8bd09b014d6348 Mon Sep 17 00:00:00 2001 From: AlexeyBarabash Date: Thu, 17 Oct 2019 22:27:17 +0300 Subject: [PATCH] Ignore conflicted records CREATE+existing_not_null during resolve --- client/recordUtil.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/recordUtil.js b/client/recordUtil.js index 27160f5..e875cd4 100644 --- a/client/recordUtil.js +++ b/client/recordUtil.js @@ -285,6 +285,16 @@ module.exports.resolveRecords = (recordsAndExistingObjects) => { normalizeBookmark(item[1]) } }) + + // Remove obvious conflicting records + for (var i = recordsAndExistingObjects.length - 1; i >= 0; --i) { + if (recordsAndExistingObjects[i] && recordsAndExistingObjects[i][0]) { + if (recordsAndExistingObjects[i][0].action === proto.actions.CREATE && recordsAndExistingObjects[i][1]) { + recordsAndExistingObjects.splice(i, 1) + } + } + } + const merged = mergeRecords(recordsAndExistingObjects) merged.forEach(([record, existingObject]) => { const resolved = this.resolve(record, existingObject)