Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: stop localOnly items from always getting synced

Abdullah Atta4ee0071eca55
diff --git a/packages/core/src/api/sync/collector.js b/packages/core/src/api/sync/collector.js
index aa033b01a..e1ad3fa5e 100644
--- a/packages/core/src/api/sync/collector.js
+++ b/packages/core/src/api/sync/collector.js
@@ -136,19 +136,20 @@ function filterSyncableItems(items, lastSyncedTimestamp, isForceSync) {
// synced is a local only property
delete item.synced;
- if (item.localOnly) {
+ if (isUnsynced && isSyncable) {
ids.push(item.id);
syncableItems.push(
- JSON.stringify({
- id: item.id,
- deleted: true,
- dateModified: item.dateModified,
- deleteReason: "localOnly"
- })
+ JSON.stringify(
+ item.localOnly
+ ? {
+ id: item.id,
+ deleted: true,
+ dateModified: item.dateModified,
+ deleteReason: "localOnly"
+ }
+ : item
+ )
);
- } else if (isUnsynced && isSyncable) {
- ids.push(item.id);
- syncableItems.push(JSON.stringify(item));
}
}
return { items: syncableItems, ids };