Skip to content

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

fix: conflict not auto resolving if remote == null

thecodrr5f8cdc7927e5
diff --git a/apps/web/package.json b/apps/web/package.json
index 760a5db0c..728747df5 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -72,7 +72,6 @@
"eslint-plugin-react-hooks": "^4.2.0",
"jest-image-snapshot": "^4.3.0",
"jest-playwright-preset": "^1.4.5",
- "playwright": "^1.8.1",
"progress-bar-webpack-plugin": "^2.1.0",
"source-map-explorer": "^2.5.2",
"typescript": "^4.1.5",
diff --git a/apps/web/src/components/diff-viewer/index.js b/apps/web/src/components/diff-viewer/index.js
index 4c16e3a98..bf774b9e3 100644
--- a/apps/web/src/components/diff-viewer/index.js
+++ b/apps/web/src/components/diff-viewer/index.js
@@ -50,8 +50,7 @@ function DiffViewer(props) {
const [htmlDiff, setHtmlDiff] = useState({});
const resolveConflict = useCallback(
- async (selectedContent, otherContent) => {
- const note = conflictedNote;
+ async (note, selectedContent, otherContent) => {
if (!note) return;
selectedContent = {
@@ -94,7 +93,7 @@ function DiffViewer(props) {
await sync();
}
},
- [conflictedNote, sync]
+ [sync]
);
useEffect(() => {
@@ -109,7 +108,7 @@ function DiffViewer(props) {
note = note.data;
const content = await db.content.raw(note.contentId);
- if (!content.conflicted) resolveConflict(content.data);
+ if (!content.conflicted) return resolveConflict(note, content.data);
setConflictedNote(note);
setLocalContent({ ...content, conflicted: false });
@@ -210,7 +209,7 @@ function DiffViewer(props) {
>
<ContentToggle
label="Current note"
- resolveConflict={resolveConflict}
+ resolveConflict={(data) => resolveConflict(conflictedNote, data)}
dateEdited={localContent.dateEdited}
isSelected={selectedContent === 0}
isOtherSelected={selectedContent === 1}
@@ -264,7 +263,7 @@ function DiffViewer(props) {
pb: 1,
pt: [1, 1, 0],
}}
- resolveConflict={resolveConflict}
+ resolveConflict={(data) => resolveConflict(conflictedNote, data)}
label="Incoming note"
isSelected={selectedContent === 1}
isOtherSelected={selectedContent === 0}
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index 142515b5c..3ce3e9611 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -9204,7 +9204,7 @@ normalize-url@^4.1.0:
"notes-core@git+https://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:[email protected]/streetwriters/notesnook-core.git":
version "6.6.6"
- resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#46d72373b513df6c5c72b805c25611f5ec3605a2"
+ resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#27752a957266ea2e8c1f8035226ebef45fc69545"
dependencies:
"@stablelib/blake2s" "^1.0.1"
fast-sort "^2.0.1"
@@ -9880,24 +9880,6 @@ playwright-core@>=1.2.0:
rimraf "^3.0.2"
ws "^7.3.1"
-playwright@^1.8.1:
- version "1.8.1"
- resolved "https://registry.npmjs.org/playwright/-/playwright-1.8.1.tgz"
- integrity sha512-nmuiDEDwB/SdAxiZQS5pLqPS3XXN8OJ1LKvTSiAbJvu+AUf7f0RD7nuq9xB0C08Emd6stx9yBMhANvD12k/+GQ==
- dependencies:
- commander "^6.1.0"
- debug "^4.1.1"
- extract-zip "^2.0.1"
- https-proxy-agent "^5.0.0"
- jpeg-js "^0.4.2"
- mime "^2.4.6"
- pngjs "^5.0.0"
- progress "^2.0.3"
- proper-lockfile "^4.1.1"
- proxy-from-env "^1.1.0"
- rimraf "^3.0.2"
- ws "^7.3.1"
-
plist@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.2.tgz#74bbf011124b90421c22d15779cee60060ba95bc"