Skip to content

Commit

Permalink
Update components-api
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed May 17, 2019
1 parent bf8b55f commit 5f65951
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
18 changes: 11 additions & 7 deletions dist/dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -22102,7 +22102,6 @@ var ComponentManager = function () {
// presave block allows client to gain the benefit of performing something in the debounce cycle.
presave && presave();

var mappedUuids = [];
var mappedItems = [];
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
Expand All @@ -22112,12 +22111,6 @@ var ComponentManager = function () {
for (var _iterator2 = itemsToSave[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var item = _step2.value;

// To prevent duplicates
if (mappedUuids.includes(item.uuid)) {
continue;
}

mappedUuids.push(item.uuid);
item.updated_at = new Date();
mappedItems.push(_this3.jsonObjectForItem(item));
}
Expand Down Expand Up @@ -22161,6 +22154,17 @@ var ComponentManager = function () {
clearTimeout(this.pendingSave);
}

var incomingIds = items.map(function (item) {
return item.uuid;
});

// Replace any existing save items with incoming values
// Only keep items here who are not in incomingIds
this.pendingSaveItems = this.pendingSaveItems.filter(function (item) {
return !incomingIds.includes(item.uuid);
});

// Add new items, now that we've made sure it's cleared of incoming items.
this.pendingSaveItems = this.pendingSaveItems.concat(items);
this.pendingSave = setTimeout(function () {
saveBlock(_this3.pendingSaveItems);
Expand Down
2 changes: 1 addition & 1 deletion dist/dist.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sn-filesafe",
"version": "2.0.6",
"version": "2.0.7",
"main": "dist/dist.js",
"scripts": {
"lint": "eslint --cache --ignore-path .gitignore --ext .jsx,.js --format=node_modules/eslint-formatter-pretty .",
Expand Down Expand Up @@ -33,7 +33,7 @@
"react": "16.0.x",
"react-dom": "16.0.x",
"sass-loader": "^6.0.6",
"sn-components-api": "1.2.5",
"sn-components-api": "1.2.6",
"style-loader": "~0.13.1",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.7",
Expand Down

0 comments on commit 5f65951

Please sign in to comment.