Skip to content

Commit 27b651b

Browse files
committed
Update components-api
1 parent 1230d82 commit 27b651b

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

dist/dist.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "sn-vim-editor",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "",
55
"main": "dist/dist.js",
66
"author": "Standard Notes <hello@standardnotes.org>",
77
"dependencies": {},
88
"devDependencies": {
99
"codemirror": "^5.31.0",
10-
"sn-components-api": "1.2.5",
10+
"sn-components-api": "1.2.6",
1111
"babel-cli": "^6.18.0",
1212
"babel-preset-env": "^1.1.1",
1313
"babel-preset-es2015": "^6.24.1",

0 commit comments

Comments
 (0)