@@ -10023,7 +10023,6 @@ var ComponentManager = function () {
1002310023 // presave block allows client to gain the benefit of performing something in the debounce cycle.
1002410024 presave && presave();
1002510025
10026- var mappedUuids = [];
1002710026 var mappedItems = [];
1002810027 var _iteratorNormalCompletion2 = true;
1002910028 var _didIteratorError2 = false;
@@ -10033,12 +10032,6 @@ var ComponentManager = function () {
1003310032 for (var _iterator2 = itemsToSave[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
1003410033 var item = _step2.value;
1003510034
10036- // To prevent duplicates
10037- if (mappedUuids.includes(item.uuid)) {
10038- continue;
10039- }
10040-
10041- mappedUuids.push(item.uuid);
1004210035 item.updated_at = new Date();
1004310036 mappedItems.push(_this3.jsonObjectForItem(item));
1004410037 }
@@ -10082,6 +10075,17 @@ var ComponentManager = function () {
1008210075 clearTimeout(this.pendingSave);
1008310076 }
1008410077
10078+ var incomingIds = items.map(function (item) {
10079+ return item.uuid;
10080+ });
10081+
10082+ // Replace any existing save items with incoming values
10083+ // Only keep items here who are not in incomingIds
10084+ this.pendingSaveItems = this.pendingSaveItems.filter(function (item) {
10085+ return !incomingIds.includes(item.uuid);
10086+ });
10087+
10088+ // Add new items, now that we've made sure it's cleared of incoming items.
1008510089 this.pendingSaveItems = this.pendingSaveItems.concat(items);
1008610090 this.pendingSave = setTimeout(function () {
1008710091 saveBlock(_this3.pendingSaveItems);
0 commit comments