A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: cannot read property dateResolved of undefined
thecodrrc16bfd31e32a
diff --git a/packages/core/api/sync/merger.js b/packages/core/api/sync/merger.jsindex 0b3e47e2a..adce86ee9 100644--- a/packages/core/api/sync/merger.js+++ b/packages/core/api/sync/merger.js@@ -61,28 +61,31 @@ class Merger {let localItem = await get(remoteItem.id);remoteItem = await this._deserialize(remoteItem);- const isResolved = localItem.dateResolved === remoteItem.dateModified;- const isModified = localItem.dateModified > this._lastSynced;if (!localItem) {await add(remoteItem);- } else if (isModified && !isResolved) {- // If time difference between local item's edits & remote item's edits- // is less than 1 minute, we shouldn't trigger a merge conflict; instead- // we will keep the most recently changed item.- const timeDiff =- Math.max(remoteItem.dateModified, localItem.dateModified) -- Math.min(remoteItem.dateModified, localItem.dateModified);- const ONE_MINUTE = 60 * 1000;- if (timeDiff < ONE_MINUTE) {- if (remoteItem.dateModified > localItem.dateModified) {- await add(remoteItem);+ } else {+ const isResolved = localItem.dateResolved === remoteItem.dateModified;+ const isModified = localItem.dateModified > this._lastSynced;++ if (isModified && !isResolved) {+ // If time difference between local item's edits & remote item's edits+ // is less than 1 minute, we shouldn't trigger a merge conflict; instead+ // we will keep the most recently changed item.+ const timeDiff =+ Math.max(remoteItem.dateModified, localItem.dateModified) -+ Math.min(remoteItem.dateModified, localItem.dateModified);+ const ONE_MINUTE = 60 * 1000;+ if (timeDiff < ONE_MINUTE) {+ if (remoteItem.dateModified > localItem.dateModified) {+ await add(remoteItem);+ }+ return;}- return;- }- await markAsConflicted(localItem, remoteItem);- } else if (!isResolved) {- await add(remoteItem);+ await markAsConflicted(localItem, remoteItem);+ } else if (!isResolved) {+ await add(remoteItem);+ }}}